do shell script "/bin/sleep 15"
tell application "System Events"
sleep
say "hello"
end tell
If I execute this script and activate the screen saver with the hot corner before the sleep command executes, the «sleep» statement does not execute but the «say» does.
If I execute it alone the sleep command executes according to what is expected.
This script worked fine in many other script … If I execute it without the «tell application “ScreenSaverEngine” to activate» statement, it works … with it, it does not work.
What could be interfering ?
Model: iMac Intel (10.6.2) + iMac G5 (10.4.11)
AppleScript: 2.3 + 2.1.1
Browser: Safari 531.9
Operating System: Mac OS X (10.6)
I would have said timing and (if AS does it) expectations, but not working with tell to activate??? Weird. An example of another script with this like you said?
There is no other script behaving strangly. I said that I tried the same script on my Intel machine and that I got the same result.
Anyway, I think I found the culprit … In the «Security» pane of the System Preferences, there is an option (translated from French) to «Require a password if the screen saver is activated». Could you check that option and retry the script «with» the screen saver activation statement and see if you get the same result …
I created a handler that, on certain conditions, puts my computer to sleep by scripting Power Manager (PM). PM is a great utility that can help you save energy and give more yeqars to your computer hardware. By script, PM can put my computer to sleep even if the screen saver is protected by a password, while “System Events” cannot.