View Single Post
Quote:
Originally Posted by RobTrew View Post
Some scripts behave in one way if run from the OmniFocus scripts menu, and another if run from the OmniFocus toolbar
The reason for this discrepancy would seem to be that:
  1. The OmniFocus script menu does save a compiled script file back to disk after the script runs (normal behaviour)
  2. The OmniFocus toolbar omits to do this (a pity)

As a temporary fix, the correct behaviour can be simulated from within the code, though it is a little cumbersome.

This version should work in the same way from the OF toolbar as it does from the OF script menu ...

Code:
set strPersist to (path to temporary items folder as string) & "Persistence.scpt"

script scrpRetainValue
	property numValue : 1
end script

try
	set scrpRetainValue to load script file strPersist
	set numValue of scrpRetainValue to (numValue of scrpRetainValue) * 2
on error
	set numValue of scrpRetainValue to 1
end try

display dialog "This time value is: " & (numValue of scrpRetainValue) as string

store script scrpRetainValue in file strPersist replacing yes