Remotely lock a Mac's screen with Launch Center Pro

Added on by Rick Stawarz.

David Sparks writing at MacSparky describes a way to use an iPhone to remotely sleep a Mac. This is useful for those who sometimes forget to lock their Mac before heading to the water cooler for the latest sportsball chat. David's recipe involves Drafts, Dropbox, and Hazel. Basically, he prescribes writing "Mac Sleep" into Drafts and sharing it to Dropbox. Hazel on the Mac recognizes the new file, and sends the Mac into dreamland.

It works well, but I wasn't satisfied having to actually type a phrase into Drafts every time I wanted to sleep my Mac. Yeah, I'm lazy like that. Lucky for nerds, Launch Center Pro has been updated with a neat feature that reduces the command to just one button. It quickly creates the Dropbox file with the proper name which thereby puts the Mac to sleep. Rather than annotating David's fantastic instructions, I wanted to rewrite the instructions with Launch Center Pro as the centerpiece.

Prepare your Mac

  1. Create a folder in Dropbox. Eg: "/Apps/Launch Center Pro"
  2. Create a Hazel rule for that folder to run an Applescript whenever a file called "Sleep Mac" appears. Also include an action for Hazel to trash the file after the script executes. Here's the script:

tell application "Finder"

    sleep

end tell

Feel free to test the script by creating a TXT file in that folder and name it "Sleep Mac."

Create Launch Center Pro action

  1. Create a new action, and name it something like Sleep Mac. Using the Action Composer, head here: System Actions > In-App Dropbox > New File
  2. Name: Sleep Mac; Text: whatever; Path: [same Dropbox path from above]; Name: Sleep Mac
  3. Tap Done, cute it up with a lovely icon, and tap Done again

You should be all set. If you're like me and find yourself wandering away from your Mac before locking it down, this recipe should ensure your information is protected from prying eyes.