This article shows you how to start with macros and offers some tips on setting them up. First published August 2006. Some details may be a bit dated. Update February 2008: I now no longer use these particular macro techniques. Instead I combine 1Password, Launchbar and TextExpander.
Break long and complex sequences down into component parts and build up the macro in stages. For example, I want Keyboard Maestro (KM) to log in to GMail, and then open several documents and applications. I start with the GMail sequence: open the page, enter the name, enter the password, click Sign in.
Set up a macro
Open KM and make sure you’re viewing the Macros tab (screenshot 1). Click the New Macro button and enter a Macro name in the Macro Editor window that appears.
Set a trigger
A trigger launches the sequence of actions you create. Click the Trigger tab, then click the New Trigger button (screenshot 2). Choose the trigger you’d like to use — you are able to choose additional triggers later. In Screenshot 3 you can see I’ve chosen Control Shift G as a Hot Key for this macro. Click the Save button to save your trigger choices.
I often use the Macro Palette trigger too. The Macro Palette is a collapsing ‘button bar’ on screen. When I move my mouse over it bar expands to reveal individual buttons for macros. Screenshot 4 shows macros I’ve added to the Macro Palette.
Actions are what macros are all about. Timing and sequence are often the biggest stumbling blocks, so take it slowly and test often. Click the New Action button on the Actions tab (screenshot 5). I choose
Open > Open URL. This opens any web address into the default browser. I enter the web address in the window that appears and click the Save button.
Now click the Save button in the Macro Editor window to save the macro. Try the trigger you assigned and see if it works. I type Control Shift G. Firefox opens and calls up gmail.com. Success! I quit Firefox and double-click my macro in KM’s Macro Editor window to edit it by adding more actions.
I need to press Tab 5 times to get the cursor in the Username field, enter my username, tab to the password field and enter a password, then press Return to click the login button. I need the
New Action > Interface > Simulate Keypress action for the Tabs and Return and the
New Action > Clipboard > Insert Text action for the name and password. Screenshot 6 shows my completed sequence. It includes pauses to slow down the action slightly to avoid errors. Trial and error showed me how many Tabs to simulate.
- Take a break. Insert a short pause — 1 or 2 seconds is often enough — between actions if things don’t seem to work when they should. It takes a few moments to load the GMail web page, and it must be fully loaded before entering the name and password. A pause gives the page time to finish loading.
- Can you find another way to do something? I could simply ask Firefox to remember my name and password for me. In this case that won’t work as I have more than one GMail account and need to specify the details.
- Duplicate Action steps by holding down the Option key and dragging a step. You can even select a list of steps by holding down the Shift key and clicking and then drag all the steps from one Macro Editor window to another.
- Beware the unexpected — I forgot Firefox would ask about remembering the password! (screenshot 7) I need to take that into account somehow. I may just set Firefox to remember it.
I use a macro utility called Keyboard Maestro (KM) to take some of the pain out of repetitive computer work. A macro is a sequence of actions. For example, I use KM to open my GMail account, enter the username and password and press the Login button. Then it also opens several documents and folders for me, all with a single keystroke.
First published in Macguide magazine Issue #28 July / August 2006 and republished with permission. This article may have been modified from the original.
See also my series on how to use Keyboard Maestro.