# based on an idea found at http://superuser.com/questions/313425/toggle-ask-for-password-after-screensaver-sleep-or-the-delay-in-10-7-using-ter # set password delay for screen saver depending on current BSSID # requires enabled support for assistive devices in Universal Access # (Bedienungshilfen -> Zugriff fuer Hilfsgeraete aktivieren) # Save this as "Application" and "Stay Open" ("Programm" und "Nicht automatisch # beenden") so that it will remain running. # It will use system_profiler once every five minutes to check whether the # BSSID of your current wireless network is the one selected as "homebssid" # below. If it is, it will set the grace period for locking the screen saver # to one hour; if it isn't, it will reduce the grace period to five seconds. If the # "home or away" status has not changed since the last check, it will not # invoke System Preferences. After changing things, it will hide (but not quit) # System preferences. global homebssid, lasthome, command set homebssid to "BSSID: 00:11:22:33:44:55" set lasthome to 2 set command to "system_profiler SPAirPortDataType" on idle set output to paragraphs of (do shell script command) set wearehome to 0 repeat with |line| in output if |line| contains homebssid then set wearehome to 1 end if end repeat if (wearehome is 1 and lasthome is not 1) or (wearehome is 0 and lasthome is not 0) then tell application "System Preferences" activate set current pane to pane id "com.apple.preference.security" tell application "System Events" tell process "System Preferences" tell first window tell first tab group click radio button 1 click pop up button 1 if wearehome is 1 then click menu item 6 of menu of pop up button 1 else click menu item 2 of menu of pop up button 1 end if end tell end tell set visible to false end tell end tell end tell set lasthome to wearehome end if return 300 end idle