Skip to content

Instantly share code, notes, and snippets.

@scriptingosx
Created February 3, 2015 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scriptingosx/e19721de5495b797ba64 to your computer and use it in GitHub Desktop.
Save scriptingosx/e19721de5495b797ba64 to your computer and use it in GitHub Desktop.
Use these scripts to lock and unlock your Mac with GeoHopper.
on processIsRunning(appName)
tell application "System Events"
return process appName exists
end tell
end processIsRunning
on GoGoGeohop(email, subject)
-- pause iTunes
if processIsRunning("iTunes") then
tell application "iTunes"
pause
end tell
end if
-- set messages status to away
if processIsRunning("Messages") then
tell application "Messages"
set status to away
end tell
end if
-- start screen saver
tell application "System Events"
start current screen saver
end tell
display notification "Geohopper Locked Mac"
end GoGoGeohop
property keyLabel : quoted form of "unlock screen saver"
on GoGoGeohop(email, subject)
tell application "System Events"
stop current screen saver
delay 0.1
if running of screen saver preferences then
set accountName to name of current user
set pw to do shell script "security find-generic-password -a " & accountName & " -l " & keyLabel & " -w"
keystroke pw & return
end if
end tell
display notification "GeoHopper unlocked Mac"
end GoGoGeohop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment