Re: Newbie Question: Script Objects (2)
Re: Newbie Question: Script Objects (2)
- Subject: Re: Newbie Question: Script Objects (2)
- From: has <email@hidden>
- Date: Tue, 18 Feb 2003 15:43:09 +0000
John Stewart wrote:
> Opening a script in a script editor recompiles it and thus resets its
> state at that point. That'll be what you're seeing.
Not correct, just opening and closing doesn't recompile as there's no
need, no changes have been made and it's already been compiled.
Sorry, I didn't put that very well. It was late, I was tired.
What I really should've said is that opening a script in a script
editor *de*compiles it to source code, which, being simple text, has
no state. When you compile that source to run or save it, you create
a new script object with initial state. That's the behaviour the OP
was seeing, and mistaking for non-persistent state.
It doesn't reset until it's re-saved which is a very different thing.
I assume you're referring to the flattened script object that's
stored on disk as a compiled script file. You can't change an
archived object's state - it's completely inert. The closest you can
do is load an _unflattened copy_, modify its state, and then save it
over the original file.
I open and close compiled scripts containing properties fairly often
without causing the loss of any data stored in one.
A script editor only replaces the original file if the user tells it
to by clicking "Save".
The mechanics are actually pretty simple to understand. My scrappy
attempts to explain them may not be. HTH.
has
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.