Skip to content

Instantly share code, notes, and snippets.

@edenwaith
Last active July 7, 2019 11:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edenwaith/3e8dc9877c3238ba50be9ee78faf0616 to your computer and use it in GitHub Desktop.
Save edenwaith/3e8dc9877c3238ba50be9ee78faf0616 to your computer and use it in GitHub Desktop.
Lock the screen in macOS High Sierra using an AppleScript
tell application "System Events" to tell process "Finder"
-- Menu bar item 1 is the Apple menu
click menu item "Lock Screen" of menu 1 of menu bar item 1 of menu bar 1
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment