November 17, 2015

Workflow Automation: Keyboard Maestro

By Drew Barontini

Workflow automation improves efficiency and productivity, and there are a variety of ways to achieve it. Continuing on in the series on workflow automation, let’s turn our attention to Keyboard Maestro.

This is the final article in a series on workflow automation. If you want to get caught up to this point, read the first, second, and third articles.

What is Keyboard Maestro?

Keyboard Maestro is the leading software for Mac OS X automation.

Keyboard Maestro’s site

If you are serious about automation on your Mac, Keyboard Maestro is the application for you. If you geek out over reducing a multi-step workflow into a single keyboard shortcut, Keyboard Maestro is for you. And, if you’re just interested in ways to improve your workflow, Keyboard Maestro is perfect for that, too.

Keyboard Maestro can do a lot. We’re going to focus on its ability to create triggers for actions (set of operations), which results in the creation of a macro.

Triggers

An event, such as a Hot Key, application launch, time of day, that starts the execution of a Macro.

Keyboard Maestro’s glossary

Triggers are the things that, well, trigger actions to occur. There are a large number of triggers available in Keyboard Maestro, but I’m going to list the ones I use the most:

  • Hot Key Trigger – when you press, hold, release, or multi-tap a key
  • Status Menu Trigger – selection from a global system status menu
  • Typed String Trigger – type a string of keys
  • Time Trigger – at a particular time of day

Actions

An action you wish to perform, such as opening a file, typing some text, controlling iTunes, and so on.

Keyboard Maestro’s glossary

As you might expect, actions are things that occur when a trigger is intiated. Just like triggers, there are quite a few actions in Keyboard Maestro. Again, let’s list the ones that I use the most:

  • Application Control Actions
  • Control Flow
  • Safari and Google Chrome Actions
  • Interface Control Actions
  • Notification Actions
  • Open Actions
  • Text Actions

Why use it?

Alright, so we know what it is, but why use it? Well, I might have given myself away before, but it’s all about automation. The goal is to reduce repetitive tasks to save time. Small adjustments in workflow can seem menial and inconsequential, but I promise the time adds up.

If you don’t believe me, you can go to the ‘Keyboard Maestro’ menu in the Menu Bar and select ‘About Keyboard Maestro’. At the bottom of the window, it will tell you how much time you’ve saved. Once you commit to it, you’ll see that time grow tenfold.

Creating a Macro

Let’s talk about the general process of creating a Macro in Keyboard Maestro.

Step One

In the ‘Macros’ pane, select the plus button at the bottom.

Creating a Macro Step One

Step Two

Set a title for our Macro.

Creating a Macro Step Two

Step Three

Click ‘New Trigger’ and set the trigger.

Creating a Macro Step Three New Trigger Panel in Keyboard Maestro

Step Four

Create one or more actions.

Creating a Macro Step Four Actions Panel in Keyboard Maestro

That’s the basic process all Macros follow. They get more complex depending on the number of actions you incorporate.

Examples

We understand what Keyboard Maestro is, why it’s useful, and the components that it’s composed of. Now, let’s look at example Macros that I use. I hope they give you insight into how Keyboard Maestro can fit into your workflow.

View Link in Incognito Window

Take the current URL in Google Chrome and open a new Incognito Window with that URL.

View Link in Incognito Window

Open Current File with ImageOptim

Take the current file in Finder and open it with the ImageOptim application.

Open Current File with ImageOptim

Sleep Screen

Put the computer screen to sleep.

Sleep Screen

Reload Chrome

This saves a lot more time than you might think.

In my text editor, when command+R is pressed, refresh the current Google Chrome tab.

Reload Chrome

We don’t want this to run globally, so we’ll look at how to keep this scoped to a specific application later on. Hold tight.

Vim Triggers in iTerm2

When in Vim, allow command+S to save the current file.

Vim Triggers in iTerm2

control+S is not the default file-save shortcut in Vim. I have the save file command mapped to control+S.

When in Vim, allow command+shift+S to save and quit the current file.

Vim Triggers in iTerm2

I have : mapped to ;.

Notifications

We can show notifications and, using time triggers, show them at a set time.

At 6:30am, show a notification to tell me to eat breakfast.

Notifications

At 11:25am, show a notification to tell me it’s lunchtime.

Notifications

Text Expansion

When we type a certain string, we can have that string replaced. If you’re familiar with TextExpander, it works like that.

Text Expansion Text Expansion Text Expansion Text Expansion Text Expansion Text Expansion

Tips & Tricks

Now that we’ve looked at some examples of Keyboard Maestro, let’s talk about a few tips and tricks to make working in it easier.

Macro Groups

Remember when we set command+R to refresh the current Google Chrome tab from within our editor? Well, we don’t want that to run everywhere. Rather, we just want it to run when we’re inside of our text editor. To do this, we need to create a new Macro Group.

  1. Click the plus button in the front-left panel (or File > New Macro Group)
  2. Name your Macro Group
  3. Change “Available in all applications” to “Available in these applications”
  4. Select the application you want to scope it to

Now, when you have in Macros in this group, they will only run when inside the scoped application. Neat, right? Think of the possibilities!

Macro Group Icon

As a tip to improve the look of your Macro Groups, you can set an icon for the Macro Group.

Macro Group Icon

As an example, you can see that my “Google Chrome” Macro Group uses the – you guessed it – Google Chrome icon. To do this:

  1. Find Google Chrome in your Applications folder
  2. Select it in the Finder
  3. Hit command+I (Get Info)
  4. Copy the icon in the top right (command+C)
  5. Select the folder icon in Keyboard Maestro and hit command+V

Alfred Workflow

If you’re an Alfred user (as you should be), there is a Keyboard Maestro Workflow in Alfred that you can use to trigger Macros.

Alfred Workflow Alfred Keyboard Maestro Workflow

Overriding App Shortcuts

Finally, I want to talk about overriding application shortcuts. If there are shortcuts within applications that don’t make sense, we can override them with Keyboard Maestro. There’s no magic here. It’s just something I want you to know.

For example, in Chrome, we can override command+S, a key I accidentally hit thinking I’m in my text editor. Instead, we can set it to trigger a confirmation box in Keyboard Maestro.

Overriding App Shortcuts

If we select “Yes,” the normal save-page action is triggered. Otherwise, it cancels.

Overriding App Shortcuts

That’s All, Folks

I hope I’ve convinced you to try out Keyboard Maestro. For $36, you can be on your way to workflow automation, saving you countless hours of clicking and typing. It’s one of a handful of “must-have” Mac applications that I use, and I couldn’t recommend it enough.

© 2019 Drew Barontini — Building products under Drewbio, LLC