Re: Newbie Question: Script Objects
Re: Newbie Question: Script Objects
- Subject: Re: Newbie Question: Script Objects
- From: Simon Brown <email@hidden>
- Date: Wed, 19 Feb 2003 18:28:33 +0000
Many thanks to all who have replied/commented on this thread. I have one
large admission to make:
Property do not persist in Smile scripts in the same way as they do in
Script Editor (and presumably Script Debugger) - or not on my machine at
least. I have just asked on the Smile Users Group about this issue, and will
report back here on it when I can (unless Emmanuel posts on the issue
first). As far as I can tell, the difference is limited to compiled scripts
run from the editor and doesn't apply to script apps compiled by the editor.
The immediate reason for the difference appears to be that Smile doesn't
prompt or even allow the user to save changes to a script containing
properties unless there are other changes to be saved. Hence the property
values of scripts always start from their initial value on re-opening the
script. I suspect there is a way to change this behaviour by altering the
class script for script windows, but I'm waiting to hear back from a Smile
guru before I start hacking around with this.
I must apologise, especially to Martin Crisp and Andrew Oliver. The
behaviour I was seeing was related to the editor I was using, rather than
being inherent behaviour of AS properties (either inside or outside of
script objects defined using the script foo...end script syntax.
NB Smile appears to ignore, but not destroy the property values. I followed
Martin's suggestion and saved my PropertyPersistenceTest script as an app,
ran it several times from the finder. Then opened it in Smile - incrementing
started again from 0, closed without saving (no save prompt), then opened it
in Script Editor - incrementing started from the value last set when running
it as an app. CURIOUS
Some of the other responses (notably those from has) will take a little
while for me to fully digest, so I'll shut up for a while until I've done so
(to save wasting people's time and wearing out their patience) much as I'd
like to immediately ask further questions on the subject.
Except...
One final question (groans all round)
has wrote:
>
- Properties of a script object retain their contents until the
>
script object is destroyed.
and
>
Script objects can survive the death of their host process.
When exactly are script objects destroyed? Is there not a difference in
lifespan between:
1) script objects declared WITHIN the current script or app
2) script objects declared WITHIN a particular handler inside the current
script or app.
3) script objects initialised on loading from an external file
I'm still trying to work out how I've misunderstood the bit I quoted
previously from p318 of ASLG.pdf:
>
The value of the property currentCount persists until you reinitialize the
>
script object by running the script again.
~Sorry if I'm being dense here, but the penny hasn't quite dropped yet :-(
I'm off now to
http://www.barple.pwp.blueyonder.co.uk - I may be gone some
time!
Thanks again for all your patience. Hopefully I'll live long enough to be a
useful member of this community, then again, senile dementia might get me
first.
-------------
Simon Brown
-------------
PPC 7500 + G3 card/OS z9.1 + Remote Access 4.02/CarbonLib 1.6/AppleScript
1.8.3/Smile 1.8.8
-------------
Simon Brown
-------------
PPC 7500 + G3 card/OS z9.1 + Remote Access 4.02/CarbonLib 1.6/AppleScript
1.8.3/Smile 1.8.8
_______________________________________________
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.