• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Property immutability
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Property immutability
      • From: Paul Skinner <email@hidden>
  • Prev by Date: Photoshop: Get the height/width of a text layer?
  • Next by Date: open files in a folder and in that folder's subfolders
  • Previous by thread: Re: Photoshop: Get the height/width of a text layer?
  • Next by thread: Re: Property immutability
  • Index(es):
    • Date
    • Thread