I'll like to run a second applescript with variable from the first Applescript.
If I do a first script to
property myName : "Kevin"
And a second script with :
set remoteScript to (load script "/Users/kevin/Documents/Script/script1.scpt")
set myName to myName of remoteScript
Then everything is fine, the issue is ! The issue is my variable are generated on the first script and so, I can't use property.
I tried to use Global instead but I always having an error
My variables on my main script are mostly set (but not only) from Javascript, I used to use plist to store them but I'm curious and I'd like to try with a another way (also I have probably thousand of variables)
Best Answer
A property is a bit different than a variable - it is more like a getter/setter declaration, where its usage performs the get/set handler of the specified script object and returns the result.
A global also has scope across script objects, but since it doesn’t have a value until one is assigned, you need to run the remote script to do that. In addition, you should probably define the same variable(s) as global in your second script, for example:
First script:
Second script: