My Keyboard Maestro Macros and AppleScripts I use the most

As one of the three readers of my blog, you’ve no doubt realized I’m on a bit of a Keyboard Maestro kick these days. I’ve been a KM user since 2010, a QuicKeys user before that, and a rabid AppleScripter before then. I’ve built up a tremendous library of scripts and macros in that time, many of which I’ve shared on this blog. However, of these macros, there’s a handful that have proven truly “sticky” and that I continue to expand upon and use on a daily or near-daily basis. I though my few readers might get more benefit from learning about these truly indispensable scripts and macros than the more esoteric mini-programs that I’ve posted here.

I haven’t posted all of these scripts and macros because most of them are fairly obvious in how they work, and enough have very specific settings for my networks, or even contain sensitive information (app tokens and such), that I didn’t want to go through the effort and “sanitize” them. But if you want to see any specific ones, sound off in the comments or bug me on the Keyboard Maestro forum and I’ll be glad to help you out.


I do not have hotkeys for opening apps, I leave that to LaunchBar. I do however have some that hide apps when they go to the background since they hog the screen and don’t use drag-and-drop much (if at all), specifically TurboTax, Keyboard Maestro Editor, Google Music (in Fluid), and Parallels Desktop.

Bring all windows to front: With Finder and Terminal, activating the app will also bring all of its windows to the front. This keeps me from opening lots of superfluous windows, and probably meets some expectation I have from back in the “layered apps” days of Classic MacOS.

Send to LaunchBar: For some of my most frequently used apps, I have an AppleScript that mimics LaunchBar’s “instant send” feature and just places the file I’m working on into LaunchBar.

For Outlook (a program I use all the time and basically despise), I have a macro that breaks me out of search mode, goes back to the Mail view, and clicks on the top mailbox. This is normally a multi-step ordeal of de-selecting and re-selecting things. I use this fifty times a day if I use it once.

I also have a set of macros for Outlook that more or less replicate SaneBox’s “SaneLater” folders - letting me put messages in deferred folders that are then recovered anywhere from an hour later to the following week.

Clean and email Word doc: I spend a lot of time dealing with change tracking and comments in MS Office documents. I hate accidentally mailing a file with change tracking still enabled or, worse still, compromising comments or change notes. This script takes the Word document I’m viewing and makes a copy without any change notes, comments, or embedded authoring information, and then creates a new email in Outlook with the file attached.

Evernote: I have about twenty scripts I’ve written for Evernote, but the AppleScript support for Evernote hasn’t been attended to for many versions and has simply decayed over time to the point that it’s unreliable.


Maybe the Finder’s an app, but it gets its own category for me.

Send: Typing a “⌘→”, gives me a palette of operations I can carry out on the current selection. These include folders I frequently move things to, compressing (zip and 7z), emailing, posting to Slack, backing up to cloud storage, and uploading to my common SFTP destinations.

New File from Template: This creates a new file in the current folder based on some templates I have stored in my documents folder - just duplicates the file to my current folder. (I have one for Evernote, too, that places the file in a note as an attachment.)

Group selection in folder: This is a handy little script that takes my currently selected items and puts them all in a newly-created folder. Great for gathering up a handful of downloaded attachments, or cleaning up a cluttered folder.

Terminal tab: This script opens a terminal tab with the prompt in the current Finder folder. There are many like this, but this one is mine and works just the way I want it to.

Archive old files on add: This is a folder action that triggers when I add a new file. It takes every file in that folder that’s more than 14 days old (either by added, created or modified dates) and puts them in an "Old Files” folder in a date-stamped folder for the month and year. I use this in my Downloads folder and my “Outbox” folder, which is sort of a temporary storage space for work in progress files. Then I can easily clean up my older files by looking at the date of their containing folders. I have a similar folder action for the Desktop that puts old desktop items in the Outbox folder (which, in turn, ages them out after 14 days).


There are macros for all my browsers (Firefox, Chrome, Safari) that will let me take the current URL and open it in another browser (via a palette).

I also have a little macro to trigger an AppleScript that closes tabs to the left of the current browser tab. There’s already a menu item to close tabs to the right, but not the left. Go figure. Now I have both.

Print-like-a-normal-person: Chrome’s standard print dialog is a travesty. I use KM to make CMD+P open a standard Mac print dialog. I’ve done the same in other programs that march to their own printing drum.

I have a macro for Chrome that’s rather single-purpose, but it goes through the process to buy a monthly work-sponsored bus pass. This is one of the more esoteric ones that I’m really glad I did. It’s about eight steps which is just enough that I’d put it off until I could pay more attention. Once I found myself with an expired pass as I got on the bus, I put this together so that I can just select it in the status menu and get it done right away.

Text Expansions

I gave up TextExpander a few years ago out of a desire to cut down on the number of oddball apps I ran on my Mac, and moved all my text expansions to Keyboard Maestro. Of these expansions, I’ve found myself using a number of them frequently, and a much greater number infrequently-to-never. The ones I use a lot are:

Email signatures: I have them for work, for personal accounts, and a couple for specific purposes (e.g. business-type communications from my personal email).

Conference call information: Automatically insert my phone number and link, I use it all the time when setting up meetings at work.

Programming/scripting text expansions: Mostly just for Script Editor, AppleScript and JavaScript, really. It includes a combination of common functions (dialogs, tell app…) and routines I use and re-use all the time (escape clipboard, sorting, etc.).

Things I like to misspell: I get certain words wrong all the time. This helps. Only downside is that I still don’t spell them correctly so when I’m on another computer/phone/tablet, I’m out of luck.

Special characters: If I type “;cc” (all my text expansions are prefixed by a semicolon), I get a palette of my most frequently used special characters - keyboard shortcut keys, ellipses, checkboxes, arrows, Mac keyboard modifier key symbols, fun ASCII shruggies and other complex goofs, and my favorite emoji characters.

Date and time stamps: I have a handful of different date stamp and time stamp formats that I use for naming files, taking notes, adding comments to things.


Home and Work: I have wifi-triggered macros for home and work that open or close certain applications, set my default printer, and (in the case of work), mute my computer so that if I have a video on in the browser or something it doesn’t bother my co-workers.

I also have a set of macros triggered by the same networks that simply enable and disable macro groups for each location. These macro groups contain repeating scheduled macros that do things specific to each location - notably kicking off my time tracking macro while I’m in the office.

Tethering: When I use my phone’s hotspot mode, I have a macro that quits all my bandwidth hogging apps that sync things (email, Google Drive, Box Sync, Evernote, Google Music Manager) and pauses CrashPlan’s backups. Then there’s another that re-starts these things when I re-connect.


I have a steadily growing set of macros, all with the hotkey of CTRL+OPT+V. This ends up bringing up a selection palette where I can paste in a variety of ways. Some of them get used more than others, but they’re all useful:

  • Totally Plain Text: This runs a BBEdit text factory that straightens quotes, zaps gremlins, removes leading and trailing white space, wraps hard line breaks, and cuts everything down to emoji-less ASCII.
  • Paste by typing clipboard: this types out each individual character on the clipboard to get around applications that seem to think it’s a security risk to paste into a field.
  • Clean and expand URL: This goes through an array of routines to resolve shortened or redirected urls, strip affiliate and GTM codes, and otherwise make it pretty.
  • Shorten and decorate URL: This does the opposite, it creates a short URL and adds Google Analytics tracking codes to it.
  • Paste image at various sizes: If I copy an image (often a screenshot), this makes it easy to shrink to a more reasonable size as a courtesy when I’m pasting it inline in an email or to Slack. My current sizes are 50%, 500px, and 1024px, more come and go now and again.
  • Paste HTML as Markdown, Markdown as HTML, rich text as HTML/Markdown, HTML/Markdown as rich text, etc… Every possibly gyration of dealing with styled text. All are powered by textutil and PanDoc (which is a bother to install, but so much more useful than multimarkdown).
  • HTML and URL encode/decode: Turn text strings into URL or HTML-safe text, or alternatively undo the same. I spend no small amount of time dealing with web services and paths for HTML files, so this is a big time saver.


Presentation Mode: I give a fair number of presentations and demos, so I have a gloriously complex AppleScript that gets my computer ready:

  1. Moves my desktop contents into a single tidy folder
  2. Turns off sleep mode, screen dimming and any screensavers
  3. Sets a boring corporate desktop picture

This script acts as a toggle, so if I run it again, desktop icons are restored to their original position, power settings are set back to where they were, and the desktop picture is restored. This is a dangerous script, though, as it’s a simple recipe for quickly exhausting my MacBook’s battery life.

Placeholder text and images: In order to mock up websites, I have a handful of generators for FPO content, including a steadily growing array of Lorem Ipsum type generators (the original, plus one based on Noam Chomsky’s writings, another on late-90’s internet hype, and a new one I put together based on the current presidential campaign hyperbole), an FPO image/link generator (using, and a random name generator for filling out forms.

Lock Screen: Simple macro - just locks my screen via a keyboard shortcut. I use it before I go to the bathroom at work so people don’t see what’s on my screen. Good habit to get into.

Twitter, Facebook

Written on May 7, 2016