I just discovered that when the (translated fron French) «Require password when the screen blanker is activated» option is checked in the Security pane of the system preferences (either 10.4.11 or 10.6.2), a script executing in background could behave not accordingly with what is expected. As an example, I have this little script:
tell application "ScreenSaverEngine" to activate delay 10 tell application "System Events" sleep end tell
If the Security option is checked the SLEEP command in this script will not execute.
So how can I have a script to fully execute if this option is checked ? I need a script to be running in background and I also need to require a password if I want to regain control of the screen after a certain period of inactivity.
Instead of checking this options, is there a way to script the locking of the screen and have my script to fully execute in background ?