Before I start sharing a bunch of Keyboard Maestro macros, we need to be on the same page when it comes to understanding the inner workings of Keyboard Maestro. So let’s get that out of the way.
Keyboard Maestro is a two part application. The first part is what you see when you launch the application: the macro editor where you can build your macros. The second part is the very lightweight Keyboard Maestro engine — this runs in the background to monitor user input so that Keyboard Maestro can make your macros actually work.
There isn’t much to know about the engine, but you can stop and start it from the
File menu in the Keyboard Maestro macro editor. So unless you don’t have any macros, just leave the engine running — conversely if your macros don’t seem to work, check to make sure the engine is running.
The Keyboard Maestro engine isn’t something you can control, instead everything the user does is inside the editor interface so that’s what I will focus on.
Once you launch the editor you will see three main panes. From left to right these are:
- Groups: I will touch on these more later, but these serve as a way to group macros together and add additional functionality to the groups of macros by limiting them to certain applications.
- Macro list: A simple list of all your macros.
- The Macro: this is the detail view of a selected macro, showing the triggers and the actions (more on those in a bit).
The interface only get’s more complicated from here, so let’s break this apart a bit more.
I mentioned that you can get additional power out of macros if you add them to a group. Groups are not a way to organize macros, they are a way to limit the power of macros and thus make your life a bit easier. For instance: there are bound to be macros that you want to work only in a certain application, or more often, never in a certain application. Groups are where you set up such controls.
So if you wanted to create a new group of macros that only works in Safari, you would simply create a group like this:
And if you wanted to create a group of macros that never work in Safari, you just change those settings to this:
The power isn’t limited there, because perhaps you want to create a group of macros that only work in web browsers, which is easily done like so:
Of course, your results will vary depending on the web browsers you have installed.
Because of the way groups work it is best to think of them as ways of preventing bad things from happening in other apps — especially if you are sharing keyboard shortcuts. However, this is not the only thing we can do, you could use the group setting in conjunction with a quit-all macro. The macro could then easily quit every application running, except those excluded in the macro group.
Groups are an important tool in Keyboard Maestro to keep in mind as you are working through the construction of more complicated macros.
The macro editor can be broken down into two views, and two panes. The two views are: description and editor. These are the views you are presented with if you are not in macro editing mode.
The two panes that appear in editing mode are: triggers and actions. When you click the edit button at the bottom of the macro editor you are able to manipulate both triggers and actions, and these panes are where you build your macro, so we need to take a deeper look.
Triggers are what’s going to set the macro into action. This is simply asking: what event has to happen for the below actions to run?
Right now there are 12 triggers, and four script triggers that you can choose from. (It’s important to note that you can have more than one trigger for each macro — as I will show in later examples.) For now, that could be a macro that runs everyday at a given time and that can also be invoked by a keyboard shortcut, or any combination of these twelve macros that you can dream up:
And the script triggers:
In this series I will primarily use time and hotkey triggers, but as you can see there are many different ways that you can trigger your macros.
To aid in the construction of macros you need to understand how each macro could be triggered.
- Hot Key: This is your basic keyboard shortcut trigger, and likely to be your most used trigger. It’s important to note that Keyboard Maestro will intercept any keyboard shortcut and run the macro while stopping the shortcut from working at the system level. Therefore if you were to assign
CMD+Cas a hotkey, the universal “copy” command would simply execute your macro, and not copy anything (unless that is your macro). So choose your triggers carefully.
- Typed String: Similar to the Hot Key trigger, except that this trigger watches for you to type a particular series of characters and then it will trigger (instead of forcing you to hold down a set combination of keys). I will show you some examples of Typed String triggers, but for now think of this as a great trigger to use to trigger macros while you are typing in a document — much like you would use TextExpander.
- Application: This will trigger a macro based on the state of one or more applications. Some examples would be if you launch a game, you can trigger system hogging applications to be quit. Or if you switch to a particular application, you could make it go fullscreen at that time. Perhaps when you quit an application you force the application to close all windows so that they do not reopen when you next launch the app.
- System Wake: Triggers macros when your Mac wakes from sleep. One of my favorite triggers here is to hide all applications on system wake — since I don’t sleep my computer much, there is a good chance that I am changing locations when I do sleep my computer and in these instances such a macro could save you some embarrassment if your screen didn’t have any of your previous “work” when you wake the computer — just saying.
- Login: Triggers a macro when you login into the account you used to create the macro. This can be used to replace login items, or applications that automatically start when you boot your Mac, but more pointedly you could use this to changes settings to specific defaults after you restart a Mac, among many other things.
- Time: This is a great trigger that I use often. You pick a time of day, and the days of the week, that you want the trigger to fire the macro for you. For example: Monday-Friday at 8:30am. I use this trigger to have my Mac remind me of daily things (Lunch Time!) and to keep my embarrassment level low(er) (Set volume to 0 when I get to work).
- While Logged in: Another fantastic trigger, this one will repeatedly trigger a macro within the parameters that you set. There’s three aspects to the trigger: how often you want the macro trigger, between what times of the day to do this, and which days of the week. (e.g. Trigger every 30 seconds between 8:30am and 4:00pm on Wednesdays and Fridays.) Another great trigger for automating a routine task, such as checking your OmniFocus inbox for unprocessed to-do items, or reminding you to look away from the screen.
- The Macro Palette entry is clicked.: A good trigger for macros that you build for one-off never to be used again circumstances. This trigger gives you a palette that overlays on your screen and you trigger the macro by clicking on an icon in the palette. I only use this if I build a macro for a specific document I am working on, knowing I will not need to use the macro later. This saves me from remembering a new keyboard shortcut. (Also handy for testing macros while you are making them.)
- The Status Menu item is selected.: Much like the last trigger, except instead of a palette that sits on your screen, there’s a menubar icon that allows you to execute a macro from it. (Hint: If you unchecked to show the menubar item in Keyboard Maestro preferences, but it still shows — make sure no macros are using this trigger and then restart.) This is the best way to trigger macros if you are keyboard-shortcut adverse.
- The Public Web entry is executed.: A bit more complicated, but you can set up a local area network webpage that is hosted by your Mac, and any macros with this trigger set, will appear on that page. You then can execute the macro by clicking on that page. Not a bad idea if you have a Mac running with no keyboard/mouse/monitor hooked up to it — just make sure your security settings are done correctly. I use this on a Mac that I use as a server to run a few commands without having to remote-login to the machine.
- This Device key: Ok, this trigger is a bit more complex; basically if an input is pressed on a particular device, then the macro triggers (with options for holding modifier keys). One potential use would be if you have a Griffin PowerMate controller and want to execute macros by clicking the PowerMate. Other options would be if you wanted to have a dedicated Keyboard Maestro keyboard, you could do so without having to hold modifiers, just using the Device Key trigger. Some good possibilities, but not many which I use.
- This MIDI note: I have to be honest, before writing this book I had no idea what this did. Here’s what Keyboard Maestro’s documentation says: “The macro can execute when the MIDI note is pressed (note on), released (note off) or continuously while it is held down. This allows you to do things like have a macro execute when the key is pressed, and then a second macro execute when the key is released, for example to toggle a setting on and then off again.” Seems like it could be useful for musicians, but I honestly still can’t think of a use case.
- Or by Script: I’ll leave the scripts out, as those are more advanced triggers than we will be getting into with this series of posts, but the Keyboard Maestro documentation does show a couple of examples that might be of use.
Now that we have the triggers all sorted out, we need to go through the action side of a macro. As the name implies actions are what the macro will actually do when it is activated. There is a wide range of actions available, and even more when you factor in that launching a script can be an action in a macro. While I won’t go through what each action does, the documentation does a decent job of that, I will say that it is worth your time to simply browse all the actions and get an idea of what’s available to you.
There are a few things that I want to go over about actions.
The very right pane in Keyboard Maestro is the action area, and the bottom section is where the heart of your macro lies.
All you need to know here is that actions are executed in the order they are shown, from top to bottom. Clicking the green plus that says
New Action will bring up the Action Picker that lays atop where your macros were previously listed. From this pane you can drag, or double-click, to add any new action to your macro.
A Few Tips for Building Macros
There’s a search box that sits in the top right corner of the action picker — this searches through all available actions. I recommend that you use this to find what you need if you already know the name of it since this will save you quite a bit of time.
All actions are grouped together by type, so that if you want to see all available clipboard actions, you can just select the clipboard group of actions — depicted as folders. I will reference where actions are by groups as I show examples of macros later on, this way you can find them more quickly.
The last, and most powerful part of actions, is that each action has additional options attached to it. A lot of the time it may not be readily apparent that there are additional options.
The best way to look for additional options is to look for arrows in the action itself after it has been added to the macro. Things like these:
There’s a lot to these options and I will dive into some of these as we go through example macros. Suffice to say that these options can double the power of Keyboard Maestro itself — they are important to look at.
That’s the basics of Keyboard Maestro, while it takes a lot to explain, it is no more complicated than taking out the garbage for most tasks. All you need to know is the order of events:
- Pull garbage bag out of garbage can.
- Tie the top of garbage bag.
- Walk garbage bag to door.
- Open door.
- Walk garbage bag to garbage can.
- Open garbage can.
- Place garbage bag in garbage can.
- And so forth.
I like to think of Keyboard Maestro as a puzzle, where it can do anything I want it to do as long as I find the right puzzles pieces to fit together. Next up, a lot of examples.
(This post is a part of a series on Keyboard Maestro, see more here.)
Note: This site makes use of affiliate links, which may earn the site money when you buy using those links.