loginwindow is sent the same Apple events as above when you log out, restart, shut down, or put the the Mac to sleep normally. The four letter codes for the Apple events are listed in AERegistry.h.Īll System Events commands above send Apple events to the loginwindow process. Put displays to sleep (10.9 and later): pmset displaysleepnow Go to sleep (AppleScript): osascript -e 'tell app "System Events" to sleep' Log out after showing a confirmation dialog: osascript -e 'tell app "System Events" to log out' Log out without showing a confirmation dialog: osascript -e 'tell app "System Events" to «event aevtrlgo»' Restart after showing a confirmation dialog: osascript -e 'tell app "loginwindow" to «event aevtrrst»' Restart without showing a confirmation dialog: osascript -e 'tell app "System Events" to restart' Shut down after showing a confirmation dialog: osascript -e 'tell app "loginwindow" to «event aevtrsdn»' Shut down without showing a confirmation dialog: osascript -e 'tell app "System Events" to shut down'
0 Comments
Leave a Reply. |