Created
November 22, 2016 02:49
-
-
Save lyokato/2b46f514e35a3fa195695aa425fe3da7 to your computer and use it in GitHub Desktop.
LockScreen AppleScript
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
use AppleScript version "2.4" | |
use scripting additions | |
use framework "Foundation" | |
use framework "AppKit" | |
my lockscrn() | |
on lockscrn() | |
set bundle to current application's NSBundle's bundleWithPath:"/Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.menu/" | |
bundle's load | |
set aClass to bundle's classNamed:"AppleKeychainExtra" | |
set aObj to aClass's alloc | |
set aKeyChain to aObj's init | |
aKeyChain's performSelector:"_lockScreenMenuHit:" withObject:(null) afterDelay:0.0 | |
delay 0.1 | |
end lockscrn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment