hi,
do i have any chances to transport/inject variables from a script to an (applescript) application?
the load command works only between scripts.
-maybe another impossible question-
The load command works for getting and setting variables of a script from an application. To get or set a variable (property or global) contained by an application then use
tell app ātheappā
launch
set its thevar to āhelloā
set avar to its thevar
quit
end tell
Iām not able to do what thewaytoapplescript suggests. I keep getting errors. However you can do it by calling subroutines. Hereās an example. Create this applescript application and make it a stay-open application.
property theVar : missing value
on getTheVar()
return theVar
end getTheVar
on setTheVar(someValue)
set theVar to someValue
end setTheVar
Basically you can see I created a āgetterā and āsetterā subroutine for the variable. Now try this script to āsetā and āgetā the variable. You can see I called the stay-open applescript application āTestAppā.
tell application "TestApp"
launch
setTheVar("testing the var")
set myValue to getTheVar()
quit
end tell
return myValue
So with a stay open applescript application you can use getters and setters to handle properties, but this also shows how you can call any subroutine in a stay-open applescript application. Essentially you would create a property for any variable, then you set it as I showed, then you would have another subroutine to act on the variable which can be called from your applescript as I showed with the āgetterā.