Sleep a Mac with a text or email message

Jan 02, '07 07:30:00AM

Contributed by: MurphyM

Left your Mac turned on? Send it a message from your phone or email account and send it to sleep. Follow these steps, or just watch the screencast to see them acted out, complete with comments.

First, download Apple's free sleep action for Automator. Create an Automator workflow that has a Pause action, and then a Sleep action. Save it as an application called whatever you like -- sleepnow for instance. You'll now need a one-line AppleScript to call the Automator application. In Script Editor, create this script:

tell application "sleepnow" to run
Change the part inside the quotes to the name of your Automator application. Save the script and remember what you named it.

Finally, open Mail and go to the Preferences. Make sure Mail is set to check for new mail every x number of minutes, then go to Rules. Set the rule criteria so a certain word needs to be in the subject, like sleepnow or somesuch. You can add other criteria if you want, like requiring the mail message to come from a particular address. Then, for the action, pick Run Applescript. Choose the script you created earlier. That's it.

You can add other actions, like playing a sound if you want to be warned that the Mac is going to sleep -- useful if you're sitting in front of it. You can cancel the command during the pause you planted in your Automator application. Obviously this tip can be used to have other actions on your Mac triggered by email. The key is the one line of AppleScript that allows you to call anything that Automator can do.

[robg adds: If you need any more detail on this hint, the above-linked screencast should provide what you need.]

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2006122910435246