Save as PDF... Macro (v11.0.3)
Save as PDF....kmmacros (6.4 KB)
Is there a way to recongize the options in these menus? I can't seem to get them to be recognized.
Save as PDF... Macro (v11.0.3)
Save as PDF....kmmacros (6.4 KB)
Is there a way to recongize the options in these menus? I can't seem to get them to be recognized.
Recognised in what way exactly? Are you wanting to always select the same menu item? Do you want to be prompted for which menu item to select? Or do you just want that menu to pop up?
Anyway that Keyboard Maestro can see those menus (if item exsists, select the menu options etc.) If there are ways to see Open in Preview, Save as PDF... and the other options then I can use If statements and select those menu items in the print dialog.
Generally speaking but I need to have Keyboard Maestro see certain items are there so I can use the same key command.
No but if knew how to make Keyboard Maestro select those items and what it sees then I could get the macro to work as hoped.
Not at all and for what it is worth I am really trying to avoid mouse click and image on screen if possible.
My appoligies for not asking the question very clearly and thanks for all the follow-up questions.
Other than using Found Image
or OCR
, I don't think so. That menu popup doesn't stay open once you press a key or click anywhere or navigate to a different window, so I couldn't find a way to have KM scan it.
Is this macro program-specific, or do you want it to work globally with any program?
Possibly you might be able to with applescript, but I'm not experienced enough to give you any direction on that. Although, my preliminary search results suggest that the applescript would have to be 'clicking' the mouse. However, if this is doable, applescript might potentially be smoother and more reliable than KM since you'd be able to code for the exact menu items rather than having to rely on image or OCR scanning.
No apologies necessary. Happy to help where I can. : ) Hopefully someone more knowledgeable will be along to offer their insights. In the meantime, if you want to cobble something together with found image or OCR, you can use the press button action with PDF[2]
to open that submenu.
Darn that is what I ran into as well. I set it in System Preference key commands years ago to command+p which is what it is in pretty much every application and then I could just hold command down and press "p" twice and I would get the Save as PDF...
Every program hopefully.
Okay I will search more with that and see what I can find.
Thank you and Merry Christmas today if you celebrate.
Is this what you are trying to achieve? To press ⌘P twice in any app to print to PDF? This can still be set in the Mac's system settings as of Sequoia (in fact all versions of MacOS). You just have to quote the menu item correctly as it is slightly different in each MacOS. But I'm probably missing what your final goal is here.
Here is it set up in Sequoia:
Yes, absolutely. It works for any version of macOS right up to the present Sequoia.
The trick is that when you set the shortcut in System Settings, you need to be careful to exactly match the format of the menu item in the dropdown you showed in your first post, depending on which macOS you are running.
So, in your case it would be "Save as PDF..."
In some versions of macOS it is "Save as PDF" without the three periods.
Before Catalina, there was an ellipsis character included so you’d have to write “Save as PDF…”, where you get the ellipsis via alt+
And you need to set the shortcut in the "All Applications" section.
Thanks for confirming this works for you all the way up to Sequoia. Perhaps there is something else going on with my system then that is not allowing it to work.
I have matched it exactly and I remember that issue quite frequently with the elipsis and the next OS they fixed that so the three dots also worked but I have included an elipsis with option+;
Not even the shortcut for "Open in Preview" works for me which doesn't have the elipsis.
Thanks for your help with this.
The most obvious is that you have something else set to ⌘P either in Keyboard Maestro or in something else that is grabbing the shortcut ahead of the OS. Have you searched for any active Keyboard Maestro macros with ⌘P as their trigger?
Yeah that is what I thought maybe too so I set it to other shortcuts just to see if it it would work. So strange it is working for you but not on any of my computers.
It is such a useful shortcut that it is one of the first things I set up on any new Mac. I have several working Macs and it works on all of them.
So, there is something that all your Macs have in common if it doesn't work on any of them...
It is worth trouble-shooting as this is definitely something that should work and when it works it is extremely useful.
First thing I would try is setting up a temporary new user account on one of the Macs and see if the shortcut works in that. If it does then you can start to figure out what is different in your normal user account.
As it is not working on any of your Macs my suspicion would be that you have some third party app running that is hijacking the shortcut. Some utility app that is possibly running in the background. If that is set to run for all users then the test of setting up a new user account might not get it.
These things are frustrating and fiddly to sort out. But in this case you will definitely solve it as there is no intrinsic reason for it not to work.
You'll probably have to involve AppleScript and "System Events" then. You may have to mess around if different apps have different print window layouts (Chrome?) and it does rely on the menu items having name
properties. But this should get you started for the standard OS dialog -- it returns a linefeed delimited list for you to use in your "If" statements:
tell application "System Events"
set frontApp to item 1 of (get every process whose frontmost is true)
tell frontApp
set theButton to item 1 of (get every menu button of group 2 of splitter group 1 of sheet 1 of window 1 whose value of attribute "AXDescription" is "PDF")
click theButton
delay 0.2
set AppleScript's text item delimiters to linefeed
return (name of every menu item of menu 1 of theButton) as text
end tell
end tell
You'll get "missing value" for the menu's separator lines, and for any item that doesn't have a name
property.
Thank you for this, I wonder if I am the only one that the Print isn't working for through macOS. I use to use that for switching to different emails to send in Apple Mail as well and that broke at the same time around the time Mavericks was released I think.
Do you mean the shortcut key for Save as PDF? If so, what happens if you try Control-P (or some other non-Command key combo)? It still works fine here in Sequoia and Sonoma.
-rob.
Yes, you nailed it. I have tried other commands and nothing seems to work for some strange reason. I tried three periods and elipsis and nothing is working.
Not even the non-Command keys? It really sounds like there's some sort of software installed that's blocking that, but I can't imagine what it might be. If you create a new user and try there, does it work? (Or create a VM and try there?)
-rob.
Yes, this is what I have already suggested to @skillet
There is no reason for the shortcut not to work so, something unique in the setup is interfering with it.
Thank you very much seems to be working in different accounts and so glad to see that. I if I can find what is plaguing my system.