Applescript: Strange delay telling finder to sleep but not in Script Editor
I'm working on a larger applescript, but I've got a problem and I've narrowed it down to the following tiny script:
tell application "Finder"
sleep
end tell
If I open the script with the script editor and use the "run" button, the script works as I expect: The computer sleeps within a second or two.
On the other hand, if I save the script as an application and run the application, whether from the finder, the dock, or the shell, the computer eventually sleeps, but only after a delay of about 30 seconds.
Obviously it makes it very hard to debug scripts when they behave differently inside the script editor than they do in the wild. How can I set my machine up so that won't be the case? Is this a known bug?
And of course I want to know how to get my script to work right outside the script editor so I can sleep my machine without any delay.
Thanks for any info!
BTW, the OS and machine in question are 10.4.8 running on an Intel iMac.
-- Robert
Intel iMac, G4 Powerbook Mac OS X (10.4.8)
tell application "Finder"
sleep
end tell
If I open the script with the script editor and use the "run" button, the script works as I expect: The computer sleeps within a second or two.
On the other hand, if I save the script as an application and run the application, whether from the finder, the dock, or the shell, the computer eventually sleeps, but only after a delay of about 30 seconds.
Obviously it makes it very hard to debug scripts when they behave differently inside the script editor than they do in the wild. How can I set my machine up so that won't be the case? Is this a known bug?
And of course I want to know how to get my script to work right outside the script editor so I can sleep my machine without any delay.
Thanks for any info!
BTW, the OS and machine in question are 10.4.8 running on an Intel iMac.
-- Robert
Intel iMac, G4 Powerbook Mac OS X (10.4.8)