Putting your Mac to sleep with Drafts »

David Sparks has a great tip for putting your Mac(s) to sleep using Drafts on iOS.

This is how it works:

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.

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

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

Read David’s whole post for the AppleScript bits. He goes on to explain how you can make this easier with Launch Center Pro —credit to Milosz Bolechowski:

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

This is a great tip, but this stuck out to me:

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.

If instead, you make a Dropbox Action in Drafts, and use a slightly different custom URL in Launch Center, you can have Drafts do everything.

In Drafts, make a Dropbox Action called MB sleep. Add “MB sleep” to the template area so that is autofilled when the rule runs. Again, make sure this is pointed to your /Apps/Drafts/ folder. Then in Launch Center, use this URL scheme instead:

drafts://x-callback-url/create?text=MB%20sleep&action={{MB sleep}}

With this, Launch Center Pro will kick you to Drafts, the MB sleep text is filled in, and will be sent to Dropbox where Hazel will pick it up. Nice thing is you don’t have to do anything but hit the action in LCP.

Here’s a little bonus if you want to be kicked back to LCP in the end:

drafts://x-callback-url/create?text=MB%20sleep&action={{MB sleep}}&x-success=launchpro://