Macworld Help: 'Sleep' your screen with a script

Put your Mac to sleep without knocking out the entire machine

Sometimes it’d be nice to be able to put just your Mac’s display to sleep, without knocking out the entire machine. For example, say you’ve scheduled a backup utility to run in the middle of the night. You want your Mac to wake up (and then, when it’s done, put itself back to sleep). But you don’t want its screen to be blazing away in the dark the whole time.

If you were sitting at the keyboard, you could press Shift-Control-Eject to put the screen to sleep. But what if you’re not at your keyboard when you want the screen alone to sleep? An AppleScript, in conjunction with Exposé’s Active Screen Corners feature, could help.

To start, go to the Active Screen Corners section of the Exposé preference pane and set the top left corner to Put Display To Sleep. Then, open the AppleScript Editor (in /Applications/Utilities), visit macworld.com/6197 then copy and paste the script from there into the editor.

That done, you can put your screen to sleep by invoking the script in whatever way you wish. In the case of the middle-of-the-night backup, you could create a recurring iCal event that starts a minute or two after your backup begins. From that event’s Alarm drop-down menu, select Run Script and then navigate to the sleeper script.

The one downside to this technique is that, if your mouse ever ventures into your screen’s upper left corner (to open the Apple menu, say), you’ll put your screen to sleep. If that makes this method seem like too much trouble, then check out a utility called Sleep Display (sites.google.com/site/linestreet).