10.6 Screen Saver collides with System (Security?) Preferences


I have a problem with a script that has worked under 10.5.x without a hitch but fails miserably under 10.6.x.

In 10.5.x it was possible to set the properties of the security preferences while the screen saver was running. This seems to fail in 10.6.x.
It is possible to set the security preferences back and forth in 10.6.x as well, but not while the screen saver is running.
Can anybody confirm this?

A very, very simple example to illustrate my problem:

tell application "System Events"
	set properties of security preferences to {require password to wake:true}
	--activate application "ScreenSaverEngine"	
	delay 10
	set properties of security preferences to {require password to wake:false}
	--quit application "ScreenSaverEngine"
end tell

The script works nicely - as long as the comments are not removed. After that, weird things happen:
Although the screen saver is terminated the screen stays black. I do see the mouse, but whatever key I press (like cmd-alt-esc, alt-tab, …) does not work either.

I would be most grateful it if anybody can confirm this, but please, please make sure you don’t have anything else open at the time except for this script. You will most certainly have to restart your machine (via SSH or by brute force) and I wouldn’t want to be guilty of any data loss because of it.

Thus said, I know I am asking a lot, but I am out of ideas. sigh
I’ve searched for a solution for about a week now. There seem to be others in the interwebz dealing with the similar problems, but I found no solution - or confirmation at least.

Anybody? Please?

This looks like the same problem: http://macscripter.net/viewtopic.php?id=31248

Hi, maelcum.

The same happens on my 10.6 machine ” although if I type my password at the blank screen, the screen saver quits immediately.

It seems that you can’t disable the password requirement while the screen saver’s running (or rather that the disablement doesn’t come into effect until after the screen saver’s quit), which makes sense from a security point of view.

Hello, Garvin.

Thank you for testing this out. I’m (in a way) glad it’s not a botched installation on my side.

I agree it probably comes from a security point of view, although the setting in the preference pane can be set and unset without a password in the GUI. It is, in fact, the only setting that can be changed in the security preference pane without admin access. Ah well…

In the meantime I’ve tried to find a way around using “System Events” (according to http://macscripter.net/viewtopic.php?id=31248) but to no avail.
I’ve dabbled with Keychain Scripting to authorize such an action with the proper credentials, but thats much more complex than I hoped it to be.
With my limited knowledge of AppleScript I don’t see a way to ever be able to programmatically unset the “require a password to exit screen saver”-option while the screen saver is running, thus the script stalls there. Too bad.

Thanks again for helping me out here! Much appreciated! Have a nice day.