Toggling Password for Screensaver and the time when this setting gets valid

hi,
i have a small snippet which checks the setting for the password of the screensaver and toggles it
If i check the setting in sys-prefs my code seems to work
-- check setting
set output to do shell script "defaults -currentHost read com.apple.screensaver askForPassword -int"
if output is "0" then
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 1"
-- other case
else
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 0"
end if
But if i start the screensaver it starts getting strange. Sometimes the setting is set and
My feeling tells me it could be related with the time it needs that the password-check checks triggered AFTER the screensaver is started.
IIRC there is a time-value it needs after starting the screensaver (if the pw-set is enabled) before it gets active to prevent the user from a direct pw-dialog. May that cause my strange problem.
Or is my change just entirely ignored ?
Or am i doing something wrong with my code itself ?
Any help is appreciated.
Best regards
fidel
Message was edited by: fidel-castro

hi,
thanks for your reply.
Great so see someone realized similar problems.
Regarding your code i dislike that it results in a password-dialog while executing.
The setting itself in System-Preferences is changeable in 10.5 without being administrator or even entering any user credentials.
Better then nothing, but somehow not perfect.
In addition i would like to understand why my attempt above does change the settings visualized in System-Preferences but doenst does what i expect =)
Lets see if someone else has additional ideas - i keep your snippet in mind as i can learn from it anyways =)
Best regards
fidel
edit: well a second look always helps - your idea needs admin privileges as you configure all security settings not only the screensaver pw option.
gonna do some tests with a reduced setup.
thanks again
Message was edited by: fidel-castro

Similar Messages

Maybe you are looking for

  • Forms6i and ora_ffi

    I have a need to use the client/server forms6i to access a Check encoder machine made by Maverick International. They provide a dll for using their code. Has anyone implemented this successfully anywhere using Oracle Forms 4.5 or 6i? If not does anyo

  • Problem with the "lenovo Rescue And Recovery" system. (lenovo 3000 N500).

    hi! yesterday i ran Kaspersky virus scan tool and it detect file named "tvtfilter.sys" as suspicious file and thefore delet it. today when i was restart my laptop, i got error message on startup that say: Microsoft Visual C++ Runtime Library Runtime

  • ISight / DV-PAL project problems

    I'm trying to export an iMovie project I've made back to a video camera, but it's coming up with the message that because it's an iSight project, it can't be done. I didn't select iSight as an option when I created the project, and haven't used iSigh

  • 32-bit

    This isn't so much a problem as something that confuses me. A while ago, I noticed that whenever I got into my System Preferences, it says that it's running in 32-bit mode. Now I went into Applications/System Preferences.app and used the Get Info com

  • Secure ACS - Administration Control per UDV/VSA

    Hello, I have Secure acs 4.0 installed with a external UDVs / VSA group for nortel device. I have a number of administrators running on my network and I want to assign a specific administrator control over a different UDV/VSA set regardless of users/