Created
April 16, 2014 19:20
-
-
Save hiilppp/10922837 to your computer and use it in GitHub Desktop.
AppleScript to unlock your Mac's screen. (Use EventScripts to automatically trigger script when a Bluetooth device (e.g., your iPhone) enters your Mac's range: http://www.mousedown.net/mouseware/EventScripts.html)
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
-- You need to create a Keychain item whose name matches what you use in place | |
-- of "[keychain_item_name]" on line #7 (and whose password is identical to your | |
-- user account's password). | |
tell application "System Events" | |
if ((get name of every process) contains "ScreenSaverEngine") then | |
set pw to (do shell script "security find-generic-password -l \"[keychain_item_name]\" -w") | |
tell application "ScreenSaverEngine" to quit | |
delay 0.5 | |
keystroke pw | |
keystroke return | |
-- set require password to wake of security preferences to false | |
end if | |
end tell |
I've attempted to use this in Yosemite to no avail. You don't have an updated version of this do you?
EDIT: Never mind! This actually works perfectly. Thank you for the awesome script.
If i am using apple script for this script it is not working. Any suggestions.
Tested this on macOS Sierra(10.12).
do shell script "caffeinate -u -t 2"
delay 1
tell application "System Events"
keystroke "<password>"
delay 1
keystroke return
end tell
Reference:
Hello
I know, it's a pretty old post but it's my best chance at the moment. I would like to unlock mac OS Montereys lock screen with the following script I've modified:
tell application "System Events"
click at {100, 200}
delay 1
keystroke "mypassword"
delay 1
keystroke return
end tell
It works so far but it won't fill my password in, it only strokes the return key. Unfortunately I'm no programmer so I would appreciate any help on this... Many thanks in advance!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cf. leaving_range.scpt: https://gist.github.com/hiilppp/10922752