Re: persistence of script properties
Re: persistence of script properties
- Subject: Re: persistence of script properties
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 05 Mar 2005 15:30:22 -0800
Title: Re: persistence of script properties
On 3/5/05 1:39 PM, "Donald Hall" <email@hidden> wrote:
> Thanks for the explanation, Paul. It works as you say. Unfortunately,
> when telling a script object to run, there does not seem to be a way
> to pass parameters to the script. So, it looks like you have a choice
> - persistent properties in your script or the ability to pass
> parameters to a run handler.
Why do you need it to _run_ specifically? Why can't you just load the script and call a handler, passing it parameters as needed? The called handler can reset properties, and you can store the altered script:
------script runner-----------
property theScriptAlias : ""
if theScriptAlias = "" then
set theScriptAlias to choose file of type {"osas"} -- choose file containing my test script below
end if
set theScript to load script theScriptAlias
tell theScript to DoStuff(3)
display dialog "after run: theScript's x is " & theScript's x
store script theScript in theScriptAlias replacing yes
-------end script runner-------------
--------test script----------------
property x : 0
on DoStuff(n)
set x to x + n
activate me
display dialog "x is " & x
end DoStuff
-----------end test script-------------
>
> If the script runner knows the names of properties in the script to
> be run, it can assign values to them before running the script.
> However, there is no way that a general script running program can
> know the names of properties a priori in a script it is supposed to
> run.
No need.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden