The only way I can think off (and I’m very much a noob, so beware) is to make the properties somewhere available in the interface, since that’s the thing that binds all the different applescripts together.
In other words set the contents of an invisible text field to the property you want to share amongst several scripts and read/write them from that text field.
Alternatively, there’s the magic of copy and paste to turn your four applescripts into one.
use AppleScript’s capabilities to load compiled script as script objects.
Then you can access the properties and call the handlers
Example:
Create script #1
property myValue : "World"
on saySomething(what)
say what
end saySomething
save it as “Value.scpt” on desktop
Create script #2 and run it
set theScript to ((path to desktop as Unicode text) & "Value.scpt")
set myScript to load script alias theScript
myScript's saySomething("Hello" & myScript's myValue)
--> spoken "Hello World"
property myshellscript : ""
on awake from nib theobject
set myshellscript to "some shell script" <- is a shell script!
end awake from nib
on thefunction()
do shell script (myshellscript)
display dialog(myshellscript as string)
end thefunction
when I load this script into the second script, and then try and use thefunction(), my display dialog appears! That means that the script was successfully loaded. However, the dialog is empty! Which means that through the script object, it can’t find the myshellscript variable …
Any ideas?
PS I’ve already implemented a crude fix which is to have the whole thing pasted into the second script to work out the shell script again … Although for the future I’d like to know how you could get around this!