osx - Putting the display to sleep (⇧⌃⏏/shift+control+eject) in AppleScript -
is possible write applescript put display sleep (which locks display if computer set lock on sleep)? can keyboard entering ⌃⇧⏏ (shift+control+eject); leaves programs, etc., running, , just turns off screen.
edit 2015-08-23: possible (from shell) of os x 10.9! go see user3064009's answer update :-)
there's no way this; there's a superuser question same thing. depending on why want this, however, there's 1 workaround know: activate screen saver. (this suggest on over superuser). can in applescript launch application id "com.apple.screensaver.engine"
, or command line running application /system/library/frameworks/screensaver.framework/resources/screensaverengine.app/contents/macos/screensaverengine
. don't know whether or not technically documented anywhere, it's worked several iterations of os now. may not want—your screen saver may, instance, colorful, isn't helpful if want black screen—but same in lock screen if have set up.
for nice catalog of other workarounds, check out this macscripter thread: documents that
- there's no scriptable way this.
- you can't tell applescript
key code eject
, there's no such key code. - you can use
pmset
tell display go sleep in 1 minute, have wait. - there's undocumented iokit way this; there's a mailing list post explaining how.
Comments
Post a Comment