Remote Control Your Mac At Home Using Only An iOS Text Editor [How-To] | Cult of Mac

Remote Control Your Mac At Home Using Only An iOS Text Editor [How-To]



Wouldn’t it be neat if you could type “Hey MacBook, STFU!” into your iPhone’s text editor and – mere moments later – have your Mac do just that? Welcome to the nerdy world of automation, where you can remote control not just your computer but your whole home, just using plain text.

With a few simple tools you can control iTunes, turn your bedroom lights down low, and… well, you get the drift. And who said nerds weren’t sexy?

With Drafts’ big update yesterday, the note-taking and note-sending app add the ability to append and prepend text to any file in your Dropbox, and to add a file to any folder in your Dropbox. These are achieved by preset actions which you configure yourself. They’re great for keeping a diary, or filing away snippets of info.

But by using some extra apps on your Mac, or even web services, you can watch for these newly-created files in your Dropbox and have them trigger pretty much anything. Today, we’ll take a look at using file-automation utility Hazel, web service If This Then That, plus a mixture of Applescript, Drafts and some plain old clever thinking.

Local Automation


You should probably be using Noodlesoft’s amazing Hazel already.

Hazel is ostensibly a service that monitors folders on your Mac and does things with new files created there. You can use it to automatically move downloads into Movies, Music and Documents folders, for example, or to open new torrent files with your app of choice. But Hazel can do a lot more.

Using Spotlight, Hazel can peek inside your text files and read them. Then, if it finds just the right string of words, it will trigger an action. The built-in actions are mostly geared to file management (this is Hazel’s purpose, of course), but you can also run shell scripts, Applescripts and Automator actions.

In this example we’ll tell Hazel to run an Applescript to play a a track in iTunes.


First, we’ll create an action in Drafts to send commands to iTunes. As you’ll see in the next step, we’ll use this to pass arbitrary message to Hazel for processing.

These are the basic settings you need to change.

It’s pretty easy. Because Hazel is going to check inside the file for its instructions, all you really need to do is make sure that the notes appear in the same Dropbox folder, and that they have a TXT file extension.

Choose your folder here…

Then we create our Hazel rule. Fire up the app, and point it at the correct folder. In this case, ~/Dropbox/Apps/Drafts. Then, set the rules to the following. You can choose whatever wording you like, as long as you remember to use the exact spelling when you tap your message into Drafts.

Applescripts (and shell scripts) can be embedded, making them less likely to break.

I made a dead simple rule, mostly because I suck at Applescript. All it does is to tell iTunes to play a track, just as it would if you reached over and pressed the play/pause button on your Mac’s keyboard. It also happens with a delay, depending on when Hazel parses the folder containing the file.

Hazel is pretty full-featured.

You can also tell Hazel to watch for other events inside the same folder, which lets you write different instructions in Drafts but send them using the same trigger. And you’re not limited to iTunes, either: anything that can be controlled by Applescript is possible.

Some things you can do with Applescript

  • Shut down or sleep your computer
  • Mute your Mac
  • Send a bunch of pre-defined emails
  • Fire up that “security” webcam you keep in the bathroom and start recording.
  • Schedule a recording on your DVR software


The best place to look for Applescripts, for iTunes at least, is Doug Adams’ Dougscripts site. Like your favorite junk shop, it’s almost impossible to find anything there, but if you take the time to dig around you’ll find some real gems. Most of Doug’s stuff is there to wrangle your iTunes library into shape, but this section is all about controlling playback.

And of course, Applescript works with a lot more than just iTunes.


Automator is way, way easier than Applescript, and does most of what you’d want anyway.

Hazel will also let you run Automator workflows. Automator can’t do as much as Applescript, but it is a hell of a lot easier to use. You can ask it to resize images, rename files, start screen captures, and even speak the text of a file. This last one could be great for pranking anybody who happens to be near your computer at that moment.



But what if you don’t own a Mac, or don’t want to leave it running 24/7? Then you can use IFTTT, or If This Then That, a web service that glues various other web services together. Like Hazel, IFTTT with keep an eye on various sources and act when they are updated. Unlike Hazel, it works for the whole internet, and it isn’t limited to watching files and folders.

Belkin’s WeMo is like a Clapper, for geeks.

IFTTT works with “Channels,” which represent the services it works with. Many go in two directions, so you can write and read Dropbox, or grab Instagram photos and send them to Flickr.Today, though, we’re interested in the WeMo channel.

WeMo is a switch that can be controlled by the internet, and IFTTT’s options are already pretty amazing. For instance, you can have WeMo switch on a light in your home when the sun goes down, or turn a light on and off when Apple’s stocks go up or down.

Using the SMS channel, you can send a message from Drafts straight to your IFTTT phone number, and upon receiving that message IFTTT will activate your WeMo switch.

Yup, forget Clappers: you can send a simple message from your iPhone and switch on the lights at home. Or any appliance that you have connected to the WeMo. Like a coffee machine, or an electric blanket, or, or…

Why Drafts?

If you were paying attention (and of course you were, because I know how smart you are are. And good looking. Did I mention how handsome/pretty you are?) then you will have noticed that Drafts is just piggybacking on other services. You could send an SMS direct to IFTTT and switch off the lights at home. And there are plenty of ways to remote control your Mac already.

If you keep it in your iPhone’s dock you will never be more than a tap or two away from anything.

But if you use Drafts, then there’s one less thing to think about. The whole point of the app is to be the default place to go if you want to write something down. SMS? Drafts. ToDo list entry? Drafts. That hot girl’s phone number? Drafts, of course. If you keep it in your iPhone’s dock you will never be more than a tap or two away from taking and sending a note.

And that’s why Drafts is ideal for this kind of automation: You don’t have to think. Just launch the app, type a few words and you’re almost there. It’s a universal inbox, yes. But now it’s on its way to being a universal remote, too.