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:
-
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.
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