im creating an automator workflow which is mostly in applescript, just taking advantage of some of the powerful built in actions for convenience, however i have hit a problem. i need at least two lists to be accessible throughout the workflow including on both sides of an action that can not pass on any such information. it seems the obvious solution is to use an external script file as a temporary memory for the script but this doesn’t seem to work.
take the following script for example.
tell application "Finder" to get name of startup disk
set thepath to result & ":tmp:tempprefs"
script myprefs
property favcolor : {""}
end script
try
set myprefs to load script file thepath
on error
set item 1 of favcolor of myprefs to text returned of (display dialog "Favourite Color:" default answer "" buttons {"OK"} default button "OK")
store script myprefs in thepath replacing yes
end try
display dialog "your favourite color is obviously " & favcolor of myprefs
it works fine in script editor but in an applescript action it won’t compile because it complains about the line that loads the script from the file with a syntax error (expecting end of file but found identifier).
i am completely stumped as to why it’s not working,
anyone got any insights? or perhaps alternative solutions?