Put Your Mac to Sleep with iOS Drafts

Occasionally, I have sensitive things on my Mac’s screen and occasionally I leave an office, or conference room, or courtroom and forget to shut the lid on that Mac. While I’ve got my Mac set to lock itself down after a few minutes, I thought it would be nice to have a way to force the issue. Mac Power User listener Mariusz wrote me about Polish Mac Geek Milosz Bolechowski who pulls this off with Drafts, a Dropbox File, and Hazel. I thought it was pretty clever so I duplicated it tonight.

This is how it works:

  1. I type “MB sleep” in Drafts and save it to the standard Drafts folder on Dropbox. (In my case it is located at Dropbox/Apps/Drafts.) I use “MB sleep” because I’m going to add a second one for putting the iMac to sleep.

  2. Point Hazel at the Drafts folder and tell it to look for a file that contains the terms “MB sleep”

  3. When Hazel sees the file, it deletes it and runs an AppleScript to put the Mac to sleep.

This is a really simple script.

tell application “Finder”

sleep

end tell

Once you set this up, open Drafts and type “MB sleep” and save it to Dropbox. Within a few seconds, your Mac goes safely to sleep.

Extra Credit

Milosz had another great idea of using a URL scheme to further automate this. If you want to take it a step further, set up a URL scheme in Launch Center Pro as follows:

drafts://x-callback-url/create?text=MB%20sleep

Then when you tap the button in Launch Center Pro, it opens Drafts and fills in the text “MB sleep” for you. You just need to send it to Dropbox for the Magic to happen. The below screenshot gallery gives you the details.

Update

Extra Extra Credit

On Twitter, @Eiscik points out the following Launch Center Pro action performs the Dropbox upload for you with no further taps.

drafts://x-callback-url/create?text=MB%20sleep&action=Save%20to%20Dropbox

Drafts 3.0, Better and Better

Drafts 3.0 (iPhone) (iPad) is out and this app just keeps getting better and better. I know there are some other applications claiming to do the same thing as Drafts (quick text capture and processing on iOS) but I’m so in love with Drafts. First, in creating Drafts, Greg Pierce filled a huge void in the iOS market that I didn’t even realize existed. Second, he just keeps raising it to new levels.

At version 2.5 he added some really useful Dropbox workflows. This new version 3.0 gives the same treatment to Evernote. There is more though. Libraries of tasks are easier to manage, there are URL schemes, and other bits of trickery to pull off automation on iOS that makes my nerd-heart go pitter patter.

For a really good review, go check out Federico Viticci’s write-up at MacStories. For OmniFocus geeks, go check out this trick from Sid O’Neill that lets you add multiple OmniFocus tasks from Drafts. If you’re still not sold on Drafts, listen to Merlin Mann and I wax poetic on it in MPU 132.

Drafts 2.5. Whoa.

There is a reason Drafts is in my iPhone dock.

The newest version of drafts just got really nerdy:

  • unlimited URL actions
  • Dropbox actions
  • action sharing
  • URL callbacks and workflow automation

So what does this pile of words mean? You can now add a level of automation to the iPhone that almost seems dirty. Go here and watch the video. If I wasn’t so busy right now, I’d drop everything and fiddle with this for hours.