Advertisement
  1. Code
  2. Coding Fundamentals
  3. Workflow

Keyboard Maestro II: Launching Apps Intelligently

Scroll to top
Read Time: 6 min

Screencast

Keyboard Maestro is not a hammer but an entire toolkit. Almost nothing comes preconfigured; you need to build and develop your own macros—the strings of actions that link different apps—and connect them to the workflow. 

You will only get as much out of Keyboard Maestro as you are prepared to put in when setting it up. 

In the previous tutorial, an introduction to Keyboard Maestro, I explained the productivity and automation app and took you through the very basics of creating a macro. In this tutorial I’m going to build on what I’ve already taught and dive deeper into launching, and working with, applications using Keyboard Maestro.

Prerequisites

For this tutorial you’ll need to be familiar with the basics of Keyboard Maestro. If you aren’t already, my previous tutorial is a great introduction.

You’ll obviously need a copy of Keyboard Maestro which is available with a 30-day free trial from the developer’s website. After the 30 days, it costs $36 for a license.

As I mentioned in the earlier tutorial, you’ll need to have granted Keyboard Maestro permission to control the Mac in the Accessibility section of the Security & Privacy preferences pane.

Guidelines for Creating Macros

While you can follow along exactly with this tutorial, the macros I am demonstrating probably won’t fit your workflow perfectly. Instead it’s better to take what I show as illustrative and modify it to fit with how you work. 

For example, just because I create a macro to launch Adobe Photoshop Lightroom, an app I use all the time, it doesn’t mean you have to. With this in mind, here are a few things to consider when modifying my macros or creating your own:

  • Test the trigger you want to use separately with a simple macro. Some of the macros you’ll be developing will have multiple steps that are time consuming to reset. If you’re not sure whether the trigger will work as you want, test it with a simple, easy to reset macro like a notification so you can fine tune its operation.
  • Similarly, test complex macros with simple triggers. If your macro only triggers at a certain time of the day, testing it and ironing out problems is difficult. Instead, build it with a hot key trigger and once everything works, change to the more complex trigger.
  • Use groups that target specific apps to reuse triggers. Simple keyboard shortcuts are often the best way to trigger macros. Just like the shortcut to quit is Command-Q universally on OS X, you can create consistency in your workflows by using the same keyboard shortcut to trigger similar macros in different apps. Just use macro groups limited to specific apps to achieve it.

Creating a “Start Work” Macro

In the first tutorial I showed how to activate Google Chrome and navigate to the Tuts+ website. That macro is simple to adapt to launch any app with a hot key. Doing so, however, doesn’t really use Keyboard Maestro’s strengths. 

Other apps like Launchbar or Alfred are better for quickly launching single apps. Keyboard Maestro is at its best when you are stringing together multiple actions like in this Start Work macro.

When I’m working, I use Byword to write and Google Chrome to research. Each app takes up 50% of my screen. With this macro, a new window of each app launches side-by-side when a short string of characters is typed.

Create a new macro in Keyboard Maestro. I’m still working in the Tuts+ Example Macros group I used in the last tutorial. For the trigger you can use a hot key or, as I do, a short string. If you’re using a string make sure it’s not something you’ll accidentally type: I use .str.

configuring the triggerconfiguring the triggerconfiguring the trigger
Configuring and testing the Start Work macro's trigger.

Ensure the trigger works as you expect. To test, I used a Notification action that just said It worked!

notification start worknotification start worknotification start work
The notification shows that the trigger worked as expected.

Once you’ve the trigger working, it’s time to build the macro. Before digging in, think carefully about how you want the macro to run and in what order. It will normally take a bit of trial and error to get everything working properly.

First, use an Open action to launch Byword. I want to use a new document in Byword so I need to send the Command-N keyboard shortcut. If Keyboard Maestro sends the keyboard shortcut too quickly Byword won’t have launched fully so it will have no effect.

launch byword startlaunch byword startlaunch byword start
Starting to configure the Start Work macro's actions.

To solve this, select a Pause Until action from the Control Flow category. For the conditions, have the macro pause until This Application: Byword is at the front. Afterwards, use the Type Keystroke action to send Command-N which will open a new document.

pause untilpause untilpause until
The macro now waits until Byword is active.

To launch Google Chrome, use the New Google Chrome Window action. I have mine set to automatically go to Tuts+.

With both applications launched, it’s time to have Keyboard Maestro arrange them on the screen. In Interface Control select the Manipulate a Window action. From the dropdown menus select Move and Resize > Left Column, the front window, and in Byword.

resizing windowsresizing windowsresizing windows
Resizing the Byword window.

Repeat the same action except targeting Google Chrome and having it aligned to the Right Column.

Run the macro and the two apps will launch new windows side-by-side. Perfect for getting to work. You can of course adapt this workflow to open and organise any combinations of apps.

Launching Apps From Situational Triggers

In the next tutorial I’ll dig deeper into situational triggers. In this tutorial I want to feature one simple macro that launches Lightroom when an SD card is attached. I take a lot of photos so I regularly import them to my Mac. With this macro, the process is streamlined.

Create a new macro called Launch Lightroom On SD Card. My camera renames any SD card to EOS_Digital so that’s what I’m going to target for the trigger. From the trigger dropdown select Mounted Volume and enter with exact name EOS_Digital

Now when an SD card from my camera is inserted the macro will trigger. Test it with a notification as before.

lightroom launchlightroom launchlightroom launch
Lightroom set up to launch when the SD card is inserted.

Once again, I want to trigger something in the application once it activates. This time I want to open the Lightroom Import Dialogue

Select a Pause Until action and have it wait until Adobe Photoshop Lightroom 5 is at the front then use a Type Keystroke action to send Command-Shift-I, the keyboard shortcut to open the Import options.

lightroom fulllightroom fulllightroom full
The full macro.

Now when I connect an SD card from my camera, Lightroom opens ready to import the images.

Conclusion

In the first tutorial I covered using a simple hot key to trigger Google Chrome. In this tutorial I’ve dived a lot deeper and looked at launching, and controlling, multiple apps with Keyboard Maestro. I showed you how to create a Start Work macro that activates the applications you need, opens new windows and then manipulates the windows so they are side-by-side. I also introduced situational triggers to launch Lightroom when an SD card is inserted.

In the next article, I’m going to explore situational triggers in a lot more depth.

Advertisement
Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.