Searching for an elegant way to select from a print menu drop down list


I created a macro to print using a specific preset, but my macro is clunky Cmd P → Tab → pause → 3 (which picks 3 Color Recto→ pause) → press print button

Because of the variable pauses, it sometimes does not work.

@gglick has taught me on many occasions about the importance of writing elegant macros (as opposed to simply emulating keystrokes) and I was wondering it applies to this macro.

thank you for your time and help


Well, "elegant" is like "beauty" -- it's in the eye of the beholder. :wink:

Rather than describing a method as "elegant", I'd rather talk about reliability and robustness. You've indicated your method lacks some reliability.

KM does not offer any Actions specific to controlling the print operation, so we'll probabally need AppleScript. And unless the app doing the printing offers some scripting commands for printing, we'll need to use UI scripting.

I'd say that UI scripting is fairly reliable, but is subject to breaking when an app, or the macOS, makes an update which changes the UI.

However, UI scripting is the most reliable method I know of for this use case. If anyone knows of a more reliable method, I'm "all ears". :wink:

While you think about this, I'll see if I can come up with a good UI script.

I'll let you decide if this macro falls into the "elegant" category, but I do think it is more reliable.

Note that this should work with all apps that use a macOS standard Print Dialog.
However, it has been tested only with TextEdit, BBEdit, and Chrome.

If you find an app it does not work for, you should get an Notification with the error message. Please copy the full Notification and paste into a reply below the Macro Topic, along with the specific app you were using.

Be sure to read and follow the setup instructions in the Release Notes.

MACRO: Set Options for Printing [Example]