Building a better macro

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

Reader Nick Phelps is having trouble creating a working macro. He writes:

I’m using a macro utility to trigger a series of actions and it’s just not working very well. The problem is that when I record the macro, most of the actions are seen as clicks at a particular location and if a window moves or menu changes, the macro fails. Do you have any tips for creating working macros?

The main tip I can offer is that whether you’re constructing a macro with a tool like Keyboard Maestro or QuicKeys or an Automator workflow, you’re far better off invoking a keyboard command than a “click here” operation. As you suggest, if something moves, you’re out of luck.

Macro applications offer the option to identify and trigger menu commands, but I’ve run into situations where the command isn’t identified, particularly with commands within a submenu. But I’ve found a solution (you can see an example of that solution below).

My solution is to assign the command a keyboard shortcut within the application (if the application, such as Microsoft Word, allows you to do so) or add one via the Keyboard system preference. To do the latter, launch System Preferences, select Keyboard, and click the Keyboard Shortcuts tab. Select the Application Shortcuts entry and click the Plus (+) button. In the sheet that appears choose the application you’d like to add a keyboard shortcut to from the Application pop-up menu. (Choose Other at the bottom of the list and navigate to the application you want if it doesn’t appear in the list.) In the Main Title field enter the exact name of the command. And finally, click in the Keyboard Shortcut field, enter a key combination, and click Add.

A Keyboard Maestro macro using custom keyboard shortcuts

Now set about constructing your macro or workflow, choosing the keyboard shortcuts you just created rather than asking the macro to click on a location or choose a command buried in a submenu.

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon