Referencing a variable in an external script

Hi all,

I’m building my first script with multiple parts and need to reference (not change, just get as a text string) a variable from one script to another. So basically, the variable resides in script A, and I need to call it in script B and use the value.

Can anyone tell me how to do this??

THANKS!!!

Hi,

use a property in script A,
then load the script as a script object into a variable and retrieve the value

a simple example:
script A (save it as testScript.scpt on desktop)

property theValue : 1

script B

set myScript to load script alias ((path to desktop as Unicode text) & "testScript.scpt")
get myScript's theValue

This is exactly what i want to do. Thanks!

But i would like to change some values permanently in the referenced script lather with another script.

Here’s the basic idea but it’s not a permanent solution.

set myScript to load script alias ((path to desktop as Unicode text) & "testScript.scpt")
display dialog "theValue" default answer "Something else."
set t to text returned of result
set ValueA of myRefScript to t

Thanks!

then you have to re-save the script after changing the property with the store script command