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!
Hey, Does this works with mountain lion ? Thanks in advance !
Script still works in Lion 10.7! ๐ Just assigned a keyboard maestro shortcut to it so I don’t launch it from launchbar anymore
Great script, thanks.
If you only change the lock setting and leave the rest untouched, it also won’t ask for your password:
set properties to {require password to wake:true}
and
set properties to {require password to wake:false}
If the preference pane is open, the change will not shown immediately, but it still works and after closing and re-opening the preferences the value is shown correctly
I renamed “AppleScript – SSPass” to “password” and it worked great with growl
I first didn’t get Growl to work either. Turned out that displaying the script in the browser window there is a problem with the character encoding so that a dash gets turned into some garbled characters.
See line towards the bottom:
notify with name "Screensaver Setting" title "Screensaver Setting" description "Passwords have been " & response & "!" application name "AppleScript รขโฌโ SSPass"
That รขโฌ after AppleScript should be a dash โ
Fixing that fixed the whole thing. Works fine now on Snow Leopard.
Getting this in my log when I goto run it, Growl 1.2.1
21/08/10 6:34:17 AM com.apple.coreservicesd[57] NOTE: Using non-mach-based version of client -> server communication, via direct function calls.
21/08/10 6:34:17 AM com.apple.coreservicesd[57] NOTE: Using non-mach-based version of client -> server communication, via direct function calls.
21/08/10 6:34:18 AM com.apple.coreservicesd[57] NOTE: Using non-mach-based version of client -> server communication, via direct function calls.
21/08/10 6:34:18 AM com.apple.coreservicesd[57] NOTE: Using non-mach-based version of client -> server communication, via direct function calls.
21/08/10 6:34:18 AM System Preferences[521] .scriptSuite warning for result type of command ‘timedLoad’ in suite ‘SystemPreferences’: the type NSNumber (‘long’) doesn’t match the result Apple event code (‘doub’).
21/08/10 6:34:19 AM com.apple.launchd[1] (com.apple.netauth.sysagent[463]) Exited with exit code: 255
21/08/10 6:38:41 AM com.apple.coreservicesd[57] NOTE: Using non-mach-based version of client -> server communication, via direct function calls.
21/08/10 6:38:41 AM com.apple.coreservicesd[57] NOTE: Using non-mach-based version of client -> server communication, via direct function calls.
Strange! The only thing I can suggest is trying to remove the AppleScript – SSPass from the Growl pref pane, then running the script again.
Apart from that, I can only suggest looking for errors in the console or seeing if there’s any info on the Growl forums.
script definately works, and growl is definately installed. in the growl pref pane I can see AppleScript- SSPass. runs with no errors. bizzare.
Still works fine for me on my Snow Leopard installation.
If you open the script in script editor and run it do you get any errors?
Just to make sure – you’re on Snow Leopard and have Growl installed! ๐
just grabbed the SL script and can’t get growl to work either. any advice?