Created
February 3, 2015 19:40
-
-
Save scriptingosx/e19721de5495b797ba64 to your computer and use it in GitHub Desktop.
Use these scripts to lock and unlock your Mac with GeoHopper.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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