Remote Macro Execution

October 17, 2011 by Gabe | [mmd] |

Keyboard Maestro macros can be executed several different ways. There’s the common hot-key trigger and text snippet trigger. These are great but sometimes I need to run a macro when I’m not sitting in front of my computer. That’s where the KM Webserver trigger and Keyboard Maestro iOS apps come in handy. Web Server Action

Webserver

This a somewhat understated feature of Keyboard Maestro. I can configure the application to expose a webserver running on a specific port. Selecting a Webserver trigger will expose the macro through a web page to anyone on a browser via my local network. That’s pretty nice, but I also expose my server through the internet. That means with the proper port forwarding I can make macros available over the internet too.

Web Server Configuration
Web Server Configuration

I’m smarter than I look, so I don’t just allow anyone to run a macro remotely. On my server, Keyboard Maestro requires authentication through the web page to run a macro. Additionally, most of the macros are relatively benign.

One, more sinister, macro I built could come in handy if my Mac every went missing. As long as the account is online, I could trigger a macro to take a screenshot as well as snap an iSight photo. Both are added to my Dropbox account. It’s also easy enough to have it send upload a text file with IP and location information through Dropbox. I’m sure I could think of a number of other mean spirited things to do too, but honestly, this was more for proof of concept. I don’t anticipate ever needing to use it.

To build this macro, first create an Automator workflow for grabbing an iSight photo and saving it with a date and time stamp to the appropriate Dropbox folder.

Automator Workflow
Automator Workflow

Next, create a short macro that activates the screensaver and then turns off the volume (so they do not hear the audible countdown) . Finally, the macro executes the Automator workflow to grab the screenshot.

Spy Macro
Spy Macro

All of these activities happen when triggered remotely by the KM webserver.

iOS App

Stairways Software makes a barebones iOS companion app. It’s pretty useless without the Mac application. However, it’s a tremendous tool when it is combined with the Mac application.

The iOS app performs two simple functions, provide the full list of macros available on your Mac (support for multiple machines too) and the ability to execute any macro displayed.

Limitations

Before you get too excited, the KM iOS app doesn’t suddenly give you a bunch of text conversion macros or quick access to the pasteboard on iOS. It is more of a remote trigger for the macro as it would run on your Mac. So if your macro is set to paste a bunch of text into the front most window, that action will happen on your Mac, not your iPhone.

Usage

While KM on iOS will not replace TextExpander Touch or Pastebot it does provide for some very interesting options. You know those old-timey apps that could only sync from your iPhone or iPad to your Mac over wifi. It sure is a pain when I try to sync those apps and realize they are not currently running on my Mac (I’m looking at you Bento). KM to the rescue. I configured a macro to start the application on my Mac and sibling macro to shutdown the application. If I try to sync Bento on my iPad and realize that it’s not running on my Mac, I can just fire-up KM on iOS and run the macro to launch Bento. VoilĂ , Bento is now ready to sync. This trick is also handy for those times when you sit down to stream a movie to the AppleTV and realize iTunes isn’t running. And Now that iTunes can sync over the air with an iPad or iPhone, it’s more important than ever to remotely start iTunes.

blog comments powered by Disqus