• Any Action in magenta color is designed to be changed by end-user
• This macro uses Google Search and Google Chrome, but can be easily changed
ACTION COLOR CODES
• To facilitate the reading, customizing, and maintenance of this macro,
key Actions are colored as follows:
• GREEN -- Key Comments designed to highlight main sections of macro
• MAGENTA -- Actions designed to be customized by user
• YELLOW -- Primary Actions (usually the main purpose of the macro)
• ORANGE -- Actions that permanently destroy Varibles or Clipboards
(1) Keyboard Maestro Ver 7.3+
(2) Yosemite (10.10.5)+
It's weird, a few days ago the top of this post that shows the original macro wasn't there, so I've got to be mistaken - appologies! I also see that there was a reference to a macro (which i could not find until now) and not a script. Thanks for clearing.
# Additional aid from tsboh
# 1) enable this action
# 2) just run on only this action: 'Try action'
ls "/Library/PDF Services"
ls "$HOME/Library/PDF Services" | sort --ignore-case
# 3) then (for now) copy list from the display result window and
# paste into the next action: 'SET List of PDF Menu Items for Prompt'
# (first three entries are standard leave them in their) replace the rest
# 4) disable this action
# future enhancement: ==> set variable and append to the first standard 3
Passing by and sticking my nose in. ls doesn't typically provide reliable/consistent output that lends itself to manipulating file paths, as stated in its man page. In its use above by @tsboh who put forward an otherwise very nifty method of retrieving PDF menu items, ls does produce additional lines for informational purposes that are superfluous to the requirements here.
This macro (and variants) fails with Ventura. My diagnosis is that the PDF button in the print dialog has changed. Pressing the "PDF" button immediately takes you to the Save as PDF file picker. To get the menu list requires pressing the down arrow in the right hand part of the PDP lozenge. I don't know how to do that in KM.
Does the down arrow have a name? Or is there another way of getting the drop down list?
Somebody at MPU or Automators (I forget which) pointed out that the 3 dots at the end of Save as PDF… have become an ellipse in Ventura (or vice versa). Something along those lines should sort it for you.
It looks as though what was a single "menu button" named "PDF" has become two items in Ventura -- a "button" and a "menu button", both named "PDF". And the KM action chooses the button, not the menu button.
A quick fix might be to use a "Detect Image" action then click just inside the right edge of the detected image. Or maybe use AppleScript GUI scripting -- you'd have to target the correct process but it would be something like:
tell application "System Events"
tell item 1 of (every process whose frontmost is true)
click menu button 1 of group 2 of splitter group 1 of sheet 1 of window 1
...which should work for the frontmost window of the frontmost app, once the "Print" sheet has been opened.