Password for Screen Saver

Hello. I searched for an answer, but I couldn’t find one that worked. So, I am posting here to see if anyone can help.

I am trying to find an easy way to switch between needing a screensaver password. At work, I want the password on, but when I bring the laptop home I don’t want to enter it every time. I figured there has to be a quicker way to do this than opening system preferences each time and manually selecting and de-selecting the option. I don’t know if an apple script or an automator process would work better. Any input would be appreciated, as it’d save me a good 10 seconds many times a day :slight_smile:

Thank you.

The script from the other thread will work after you need to check “Enable access for assistive devices” at the bottom of the Universal Acces pane in System preferences.

Hi,

try this


set text item delimiters to {""}
set MACaddress to words 2 thru 7 of (do shell script "ifconfig en0 ether | grep -i ether") as Unicode text
set screensaverPlist to "~/Library/Preferences/ByHost/com.apple.screensaver." & MACaddress
set askForPassword to (do shell script "defaults read " & screensaverPlist & " askForPassword") as integer
do shell script "defaults write " & screensaverPlist & " askForPassword -int " & ((not (askForPassword as boolean)) as integer) as Unicode text

Thank you! This is exactly what I needed. I added a ‘quit’ at the end so I don’t even have to close system preferences now. Thanks again.

Stefan I love the boolean use. :slight_smile:

This is the latest way of doing it
And saves on getting the MAC address

set askForPassword to (do shell script " defaults -currentHost read com.apple.screensaver askForPassword") as integer
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int " & ((not (askForPassword as boolean)) as integer) as Unicode text