Re: Running a script library from within Filemaker Pro 6
Re: Running a script library from within Filemaker Pro 6
- Subject: Re: Running a script library from within Filemaker Pro 6
- From: Stan Cleveland <email@hidden>
- Date: Tue, 20 May 2008 17:00:07 -0700
- Thread-topic: Running a script library from within Filemaker Pro 6
Title: Re: Running a script library from within Filemaker Pro 6
On 5/20/08 3:15 PM, "Jim Skibbie" wrote:
The variable foo is set as a property, but it errors when it is called as part of the “ThisScript” even though it is defined in the main script.
I guess my question is mainly regarding variables passing from one script to the next.
It looks like the handler defined in one script can be called in another, but the property doesn’t seem to transfer it’s values/existence in the same fashion.
Generally speaking, each script is a separate environment, so you need to set up each script with its own “foo” property. Add commands to the main script to initialize the “foo” property in each script to the desired value. (The constant “missing value” is overridden when each property is initialized.)
Your code, with these changes, would look something like what’s below. Note that if you later need to change the value of “foo”, you’ll need to change all three occurences of “foo” in the scripts, similar to the way they were initialized.
HTH,
Stan C.
Main script:
property foo : missing value
set ThisScript to load script (alias "Macintosh HD:Users:schawk:Desktop:ThisScript.scpt")
set ThatScript to load script (alias "Macintosh HD:Users:schawk:Desktop:ThatScript.scpt")
set my foo to "mainvalue" --> initialize Main script’s foo
set ThisScript's foo to my foo --> initialize This script’s foo
set ThatScript's foo to my foo --> initialize That script’s foo
tell ThatScript to run
set x to ThisScript's thisresult(" World")
This script:
property foo : missing value
on thisresult(x)
set y to "Hello World " & x & foo
return y
end thisresult
That script:
property foo : missing value
on run
set z to ThisScript's thisresult("Hello")
set z to z & " " & foo
activate
display dialog z
end run
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden