Property immutability
Property immutability
- Subject: Property immutability
- From: Paul Skinner <email@hidden>
- Date: Thu, 27 Feb 2003 15:13:08 -0500
I have a script that doesn't want to change the value of a property
within it when run as an application.
property lastSaverlaunched : missing value --pid of last Saver launched.
set activeSavers to getRunningSavers()
if activeSavers is {} then set lastSaverlaunched to missing value
if lastSaverlaunched is missing value then
if activeSavers is {} then
set lastSaverlaunched to runSaver(chooseSaver())
else
display dialog "You are already running a screensaver. Please quit it
before launching this application"
end if
else --script has previously launched a saver.
set action to button returned of (display dialog "What would you like
to do?" buttons {"Cancel", "Change Saver", "Quit Saver"} default button
"Cancel")
if action is "Quit Saver" then quitSaver(lastSaverlaunched)
if action is "Change Saver" then
set previousSaverPID to lastSaverlaunched
set lastSaverlaunched to runSaver(chooseSaver())
delay 1 --allow the new saver to launch before removing the old one.
quitSaver(previousSaverPID)
end if
end if
Ok, I run this repeatedly in the editor and all is fine. I run it as
an application and the property lastSaverlaunched never gets modified
when the action is "Change Saver". The saver is changed, but the
property doesn't change, so the previous server isn't killed. Why?
This is very troubling. Totally different behavior in the editor and
as an app is hard to trace.
No the handler's aren't included. None of them contain any references
to lastSaverlaunched. I'll gladly post them if it helps. I'm hoping I'm
missing something obvious.
Paul Skinner
_______________________________________________
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.