There’s a fix for working on Snow Leopard, just read on MacDuff. Thanks to David and Januz for this!

Recently, I’ve been looking for a script to toggle my screen-saver password for my MacBook.
While out and about I want to make sure my Mac is safe from stray fingers by making sure a password is required before waking, but when at home or in university there’s no need for this extra layer of protection.

Searching the web I found absolutely nothing, except a few scripts that were old and broken.

The only solution; I decided to write my own. You can download the applescript here in zip form (10.6 – Snow Leopard compatible version here), or view the script in your browser here (10.6 – Snow Leopard compatible version here). (Warning – it’s not the easiest thing to read!)

This applescript toggles the screen-saver password, and then displays a growl notification telling you whether the password has been enabled or disabled – handy if you’ve pressed it one time too many and you’re not sure if your screen is locked or not!

If you don’t have growl installed I suggest you download it now from here!

If you’d prefer not to use growl, then just delete the two blocks of code between the
tell application "GrowlHelperApp"
and the next
end tell

I used quicksilver (download it here if you haven’t already!) to create a trigger that means I only have to press a few keys to toggle the password. Works great!

*** Update ***

If you’ve downloaded this script and it isn’t working, it’s probably because you have different settings in your system preferences to me. To find out what yours are open up script editor (found in Applications/Applescript) and run this script

tell application "System Events"
tell security preferences
get properties
end tell
end tell

Hopefully you’ll get a message in the ‘result’ log at the bottom of the script editor. The details in here should match the details on the 3rd line which starts with
if get properties is {require....
except for the first item which should stay as
require password to wake:true,

Enjoy 🙂

*** Note ***

If you’re logged into a non-admin account, this will ask you for the password every time. Annoying, but hopefully bearable!