I want to have my screensaver password enabled only if I am not around my computer. I hate typing it in, but I fear leaving my laptop unattended and unprotected at the same time. The same problem occured to Jesse David Hollington and his article helped me a lot.

Downloading and installing Proximity is pretty straightforward, as is configuring it to use my phone and what applescripts to run when the phone enteres and leaves bluetooth range. Following Hollingtons instructions on screen saver passwords by adding some applescript and compiling the notify.c was pretty easy to make the screensaver appear password protected if the phone is out of range and disabling the screensaver password when in range. It is possible to use growl with applescript, so I went on copying the script to register with growl and added notifications to both my scripts. Taking Hollingtons script for iSync as a basis I added some growl notifications to adjust it to my needs.

It now works great, really!

[edit] Well, not really great. THe bluetooth link between phone and computer gets lost sometimes resulting in a password-protected screensaver whilst watching a movie, which sucks. If it really is worth the efford only time will tell. [/edit]

Phone enters range script

-- Disable the screen Saver Password and quit screensaver
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 0"
do shell script "~/Applications/Scripts/notify"
tell application "ScreenSaverEngine" to quit
tell application "GrowlHelperApp" to notify with name "Proximity" title "Proximity" description "Disabled screensaver password" application name "Growl Proximity AppleScript"

-- Run iSync if needed
tell application "iSync"
activate
delay 0.1
tell application "System Events" to set visible of process "iSync" to false
if last sync is less than ((current date) - 900) then
synchronize
repeat until syncing is false
delay 1
end repeat
quit
tell application "GrowlHelperApp" to notify with name "Proximity" title "Proximity" description "Phone Syncronized" application name "Growl Proximity AppleScript"
else
quit
tell application "GrowlHelperApp" to notify with name "Proximity" title "Proximity" description "Syncronization not required" application name "Growl Proximity AppleScript"
end if
end tell

Phone leaves range script

-- Enable Screensaver password and start screensaver
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 1"
do shell </code>script "~/Applications/Scripts/notify"
tell application "ScreenSaverEngine" to activate
tell application "GrowlHelperApp" to notify with name "Proximity" title "Proximity" description "Phone out of range." application name "Growl Proximity AppleScript"

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free

© 2011 Ronald! Suffusion theme by Sayontan Sinha