USER SETTINGS:
• 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
REQUIRES:
(1) Keyboard Maestro Ver 7.3+
(2) Yosemite (10.10.5)+
Please excuse my English @JMichaelTX is not good. I’ve created with Shortcus this palette with print commands. Without Applescript etc.
The palette can be accessed in any program with a touch gesture (BetterTouch Tool) on the trackpad. I have made a small video here.
A tutorial will follow the next days.
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.
@JMichaelTX Great work, thank you very much. Very Very useful and handy macro.
I have got a suggestion to even improve your great work.
I'm not familiar (yet) in sharing macro's and actions's here. So I'm gonna share the 'code' of one simple action in this text box and a image. Hope it is helpful.
#
# 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.
NB:sort -dfi is equivalent to sort --dictionary-order --ignore-case --ignore-nonprinting
± @ccstone's sed command for those that encounter the issue he mentioned causing sort to fail.
On my system (which has a limited selection of PDF options that I never use), the above command outputs this:
Add to iBooks
Save PDF to Scrivener
Save to iCloud Drive
Save to Web Receipts
Send in Mail
Send via Messages
which is cleaner than the ls output, which was:
/Library/PDF Services:
/Users/CK/Library/PDF Services:
Add to iBooks
Save PDF to Scrivener
Save to iCloud Drive.pdfworkflow
Save to Web Receipts.pdfworkflow
Send in Mail
Send via Messages
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
end tell
end tell
...which should work for the frontmost window of the frontmost app, once the "Print" sheet has been opened.