Toggle screensaver password applescript
This doesn’t seem to be working on Snow Leopard. I’ll look into this and hopefully make a new post!
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, or view the script in your browser 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 and the next
tell application "GrowlHelperApp"
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 except for the first item which should stay as
if get properties is {require....
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!
Tags: applescript, mac, os x, quicksilver, screensaver, snow leopard
December 7th, 2008 at 1:48 pm
Thanks for pointing that out – helped me with my small project. Thumbs up !
February 12th, 2009 at 8:28 pm
Just a quick note to say thanks for the script – exactly what i was looking for!
All the best
September 25th, 2009 at 5:10 pm
Thank you. Very helpful
September 26th, 2009 at 10:18 pm
There are many interesting things in this article. Author is a good guy
October 10th, 2009 at 10:49 pm
Anyone able to get this script or any applescript that toggles the screensaver to work with Snow Leopard?