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: Jim Skibbie <email@hidden>
- Date: Mon, 19 May 2008 22:15:32 -0500
- Thread-topic: Running a script library from within Filemaker Pro 6
Title: Re: Running a script library from within Filemaker Pro 6
OK, now I have a follow-up question regarding variables like local, globals, properties and handlers and how they work when loading or running scripts from within scripts.
Here’s my question. I wanted to split my script into smaller chunks to fit within FileMaker’s ScriptMaker function. The main script starts with some properties, the second script is a bunch of handlers, the third script uses some of the handler’s from the second script. The properties don’t seem to be known from one script to the next and when the third script runs, I get errors that the handler from the second script are not defined. I’m assuming you can’t chain together scripts like this.
What are the rules when it comes to what variables/handlers can pass from one script to the next. It looks to me like none from the scenario below. I’m assuming to get the handler from ThisScript to be available in ThatScript, that I would need to load it into ThatScript instead of loading it into the MainScript? I’m also assuming that everything needs to be self contained in the script that is being asked to run and that the properties from MainScript don’t transfer from one script to another even though they are being called by the MainScript?
This all seems confusing, but this group seems to be very good at explaining these things in an uncomplicated manner. I hope my example below makes sense. It doesn’t work, but that’s to illustrate my question.
Thanks.
Jim
MainScript:
property foo : "mainvalue"
set ThisScript to load script file ((alias "Macintosh HD:Users:jim:Desktop:ThisScript.scpt" as string))
set ThatScript to run script (alias "Macintosh HD:Users:jim:Desktop:ThatScript.scpt")
--tell ThatScript to run
set x to ThisScript's thisresult(" World")
ThisScript:
property foo : "thisvalue"
on thisresult(x)
set y to "Hello World " & foo & x
return y
end thisresult
ThatScript:
property foo : "foo"
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