Keyboard Maestro Macros

I use the fabulous app Keyboard Maestro to automate much of what I do on my Mac, and have written a number of articles describing how I use it.

The following index of my commonly-used macros not only provides usage ideas, but also code examples that can apply in other context—e.g. encrypting with GPG, using KM variables in shell scripts, window manipulation, etc. If you’d like to contribute to this list, please don’t hesitate to contact me.

  • Daily Backup — This macro backs up certain data files each day to compressed ZIP archives. It provides an example of how to pass KM variables to a shell script.

  • Print to PDF — This macro invokes the standard OS X Print function, waits for the print dialog to appear, and then invokes the key command that I’ve bound to “Save to PDF…” from the Shortcuts area of the Keyboard settings.

  • New Inbox Entry in Notational Velocity — I have a text document in Notational Velocity called @INBOX that I use as a place to dump text clippings. This macro switches into NV, finds the @INBOX document, and pastes the clipboard in a new time-stamped block.

  • Move Window to MacBook Air — I keep my 11“ Macbook Air connected to a 27” Thunderbolt display, in open-shell mode. This macro sends the current window from the Thunderbolt display to the MacBook Air.

  • Backup & Encrypt iBank File — I keep my iBank data file on an encrypted volume. When the volume mounts, this macro asks if I want to backup my data file. If I do, it creates a GPG encrypted, compressed backup of my data file in Dropbox. This macro provides examples of using Keyboard Maestro variables in shell scripts, as well as how to GPG encrypt a file to your default key without being asked to verify key validity.

  • Cleanup Text — This macro filters the clipboard, removing styles, unwrapping text and zapping any control characters, and then pastes the clean text into your document.

  • Get URL to selected message — This macro gets the message:// URL to the currently selected message in (I often paste this URL into todo or task management apps to provide a handy one-click reference back to the original message.)

  • HelpScout, mark as spam or closed — These macros reply to the currently active incoming HelpScout message in, marking them “closed” or “spam”.

  • Kill systemstats — On my Macs which run OS X Server, the “systemstats” process sometimes goes wild and begins consuming the majority of the computer’s CPU resources. This macro checks each 10 minutes to see whether systemstats is using too much CPU, and kills it if so. If it kills the process, it sends me an email letting me know.

  • Paste with Smart Quotes — This macro copies the highlighted selection to the clipboard, filters the clipboard, educating quotes, and then pastes the results.

  • Prepare Confidential Data for Backup — On the first day of each month, this script prepares a zipped archive of my Yojimbo and 1Password data, ready for off-site backup.

  • Check internet speed with Speedtest — This script runs the command-line version of, creates a notification displaying the results, and logs the output to a file.

  • Tweet Blog Post — After posting a blog article, I’ll proof-read it in Safari, and then post it to Twitter. When I type “@post” in a Tweet, this macro is triggered, which replaces that text with a tweet composed of the current Safari window’s title (stripping out the blog name that WordPress appends) and URL, separated by an em-dash.

  • Keep Apps Alive — This macro runs every 10 minutes on my Mac mini server, checking that Mail, CrashPlan, Dropbox and BitTorrent Sync haven’t unexpectedly quit. If it doesn’t find them running, it will relaunch them and email me a notification.

Agree? Disagree? What do you think?