Re: persistence of script properties
Re: persistence of script properties
- Subject: Re: persistence of script properties
- From: Donald Hall <email@hidden>
- Date: Sat, 5 Mar 2005 14:39:48 -0700
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.
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.
Don
At 2:01 PM -0700 2005/03/05, Paul Berkowitz wrote:
On 3/4/05 11:18 PM, "Donald Hall" <email@hidden> wrote:
> I thought that script properties that were changed when a
compiled script was
run were saved by the 'store script' command, but this does not
seem to be the
...snip...
> which I would have gotten if 'x' had been saved by 'store script'.
Can anyone explain this?
Change the line
run script theScript
to
tell theScript to run
and you'll see what you were expecting; "after run: theScript's x is 1",
and then "2" on the next run, and so on.
You were using the osax 'run script'. 'run script' seems to run a separate
instance of theScript in memory. It doesn't seem to affect the properties of
the variable theScript representing the loaded test script, so when you
store theScript you're just storing the same script object with the same
values you started with. If you tell the loaded script to run, on the other
hand, then its own property x's value is changed and later stored with the
new value.
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
email@hidden
http://www.appsandmore.com
_______________________________________________
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