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 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!
Fantastic – thanks a heap for this
.. But just one prob – I’m not getting the growl notification. (I do have Growl running and many other notifications work fine.)
macbook2.16G / 10.6.4. Can anyone help? Thanks.
You’re a genius!
Thanks to David and Januz for a Snow Leopard compatible version!
An updated applescript with a few more fixes is uploaded.
My version will check to see if the System Preferences is open and if it is it’ll reopen it to the same pane so as not to disturb your workflow.
@ David: THANKS!!
The Script works. The only thing I had to do was add
tell application “System Preferences”
quit
end tell
in front of your script because the script won´t function if the Preferences are running. I also removed the
set volume without output muted
set response to “”
lines because I didn´t need them and I had to replace the quotation marks but after that everything works just fine
Thank you and all the best,
Januz
Hi,
Yes I’m using a version of this on Snow Leopard.
Here’s the script (simplified to the very basics):
tell application “System Events”
set volume without output muted
set response to “”
tell security preferences
if get require password to wake is true then
set require password to wake to false
set response to “De-Activated”
else
set require password to wake to true
set response to “Activated”
end if
end tell
tell application “GrowlHelperApp”
set the allNotificationsList to {“Security Setting”}
set the enabledNotificationsList to {“Security Setting”}
register as application “AppleScript – PW” all notifications allNotificationsList default notifications enabledNotificationsList icon of application “System Preferences”
notify with name “Security Setting” title “Security: PW-Settings” description “Passwords have been ” & response & “!” application name “AppleScript – PW”
end tell
end tell
Does this help somebody?
BR,
David
Anyone able to get this script or any applescript that toggles the screensaver to work with Snow Leopard?
There are many interesting things in this article. Author is a good guy
Thank you. Very helpful
Just a quick note to say thanks for the script – exactly what i was looking for!
All the best
Thanks for pointing that out – helped me with my small project. Thumbs up !