Mac quick actions> Create PDF from 2 files

Hi awesome people!

I have 2 PDF files saved in a folder. I want to use Mac quick actions > Create PDF to merge the 2 files. I do it manually several times in a day (select the 2 files, right click, quick actions and create pdf)... Is there any way to do this with KM. I would like to merge those files and combine in 1 pdf without using any other tool just the quick action of mac or something simple, but not any website or anything like that.

This is what I do manually:

I don't like to use KM mouse actions because the mouse position usually varies a lot and does not work for me.

THANK YOU!!

@Yisbel_Carrasco,

I know this isn't what you asked for but you can, also, use the finder with a different view (Column or Gallery View). This one button press (Create PDF) should help you in the meantime. This is how I perform this action.

KC

1 Like

I notice your contextual menu has a keyboard shortcut for Create PDF

image

Just wondering why you can’t get KM to press those keys for you


2 Likes

Hi! I created that shortcut hoping to do exactly that, but it only works if you select the 2 files and right click first. I know how to open the folder and select the 2 files, but don't know how to do the right click, I've tried the mouse actions, but it never works for me, it always click somewhere else...... TY for taking a look at this!!

1 Like

Hi @Yisbel_Carrasco , you might want to try this macro that works on my Mac.

After selecting the pdf files trigger the macro and it will hopefully work. I took the AppleScript code from another posting in this forum here: Has Anyone Figured Out a Way to Replicate the Windows "Menu Key" on a Mac Using KM? - #10 by Zabobon and added the Quick Actions bit at the end.

Anyway, have a go and let us know!

Download Macro(s): Right Click Context Menu Finder.kmmacros (4.3 KB)

Macro-Image

Keyboard Maestro Export

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 10.14.6
  • Keyboard Maestro v10.2
5 Likes

OMG, this works perfect!!! Thanks so much, Appreciate your help!!!!:sparkles:

1 Like

Can you mark it as a solution please, so others who come along in future will know! :blush:

1 Like

Done!! TY again!

1 Like

I should also point out that by replacing the text in the last two Type actions you can run most any command in the Finder contextual menu.

For instance, by using this text

  • Sort By%Return%Name%Return%

you can make the files be sorted by name (duh).

Or this:

  • Open in New Tab%Return%

which opens the currently selected folder in a new Finder tab.

Neither of these examples requires two Type actions, so you can delete one of them.

Hope that helps


2 Likes

Thanks so much!! I would love to learn more about Apple script (how to write that long script WOW) to use in KM or any other software. Do you know of a beginner training or course that I can start with? TY!!!

Since you’re a fast learner :wink: you’ll have much less trouble than me with AppleScript! Honestly - I really do not like it as a programming language and if I don’t use it for a couple of days it seems like I have to learn it all over again! I get most of my AppleScript by researching this forum and the internet in general (that is ‘borrowing” from others).

Here’s a link to some stuff about AppleScript in this forum: Search results for 'Learning AppleScript ' - Keyboard Maestro Discourse

The first two hits are worth looking at as they’ll give you some pointers. There are plenty of books and other resources like Late Night Software, MacOS Automation and the Apple documentation.

There is a book I’ve used: the O’Reilly AppleScript: The Definitive Guide, Second Edition
by Matt Neuburg which is comprehensive.

If you’re serious about AppleScript you’ll need the best AppleScript IDE which is Script Debugger which you’ll also find at Late Night Software.

I could go on but you get the idea I hope.

1 Like

THANK YOU!!! I will take a look at those resources!:pray:

I can't get this to work on my Mac. It selects the share option on right click. My language is set to Brazilian Portuguese, does it affect the macro?

I can't get it to work either. Similar problem like the poster before me. My Mac's language is German. Running on Ventura. Do I need to adjust anything?

This isn't working for me.

I downloaded the macro, enabled it and its folder, selected 2 pdf files on the desktop and triggered the macro. I got this error:
b7d08e0b856641ca0b831a0eaf92fdef467752bf

I'm running KM 11.0.3 on Mac OS 15.4.1 with a M3 MacAir

I'd really like to know how to access the context menu items, as well as sub-items as in this case:
sub

Is there a way to do this with the Select Menu type actions (which I find are otherwise brilliant)?
select

Yes, I know things can be done by finding images, but I like to avoid that solution as much as possible, and using menus instead is so elegant and certain.

The macro is written for files selected in a window -- probably one that is in "List" view, too.

Unfortunately, the context menu isn't (AFIAK) accessible this way.

But you can drive it via the keyboard -- and since you're on macOS 15 you can also pop the context menu with a keystroke, making workarounds from 2 years ago unnecessary...

With items selected in a Finder window, these actions should bring activate the "Create PDF" contextual menu item:

image

This still won't work with items selected on the Desktop, however -- ⌃Return doesn't work on selected items in that situation -- but using a Finder window that targets your Desktop is fine.

2 Likes

No - those actions don't work with contextual menus.

Since I'm away from my Mac and don't have Sequoia I'll give you some instructions for you to try.

  1. Use System Settings to assign a hot-key shortcut to Create PDF in Finder
  2. Since you're using Sequoia, you can use ⌃Enter to bring up the contextual so in the macro, replace the AppleScript action with a KM action to simulate the keyboard shortcut to bring up the contextual menu in Finder
  3. Replace the 2 other actions in the macro with one that just simulates the shortcut you've set up for Create PDF

Since I can't test this out (even if I were in front of my out-dated Mac) you'll have to have a go yourself... good luck :smile:

3 Likes

If you are on macOS Sequoia there is a very robust way to make PDFs from files selected in the Finder using Apple Shortcuts and Keyboard Maestro.

Make an Apple Shortcut to combine selected files in the Finder into a PDF and then use Keyboard Maestro to launch that Shortcut.

The Shortcut can be like this:

Here is a link to download it:

https://www.icloud.com/shortcuts/c22204a30e634f37b36090b8c2cf8fb5

And the Keyboard Maestro Macro to launch it is as simple as this:

Make PDF from Selected Files.kmmacros (2.8 KB)

In this case, I select the files in the Finder and press ⌄P to create a PDF of them combined.

The great thing about Apple Shortcuts is they sync to all your Macs via iCloud so, you only have to make this Shortcut on one Mac and you will have it on all of them.

3 Likes

(Ha! @Zabobon beat me to it -- I got called away halfway through to fix a Powerpoint problem...)

Another option, at least in Sequoia -- Shortcuts.

If you create a Shortcut like this it will create a combined PDF in the same folder as the selection, named for the first file in the selection:

(Note: click the "nigel" in the 4th action and set it to your home folder.)

...you can then call it from a KM macro and, since the Shortcut outputs the file path of the new PDF you can use that in a "Move or Rename" KM action:

image

I'm sure you could do the rename in the Shortcut, but this shows how simple it is to pass data back to KM to use later in the macro.

2 Likes

Oh this is so great. Now I have access to the context menu; and just as you said, the 2 crucial things here are the ^Return keystroke and being in List view -- so it can still work for items on the Desktop if one navigates to a Finder folder for the Desktop ("Desktop - Local") which is placed in List view.

Thank you to @tiffle and @Zabobon but I guess I should have said that I was only trying to merge pdf's because that's what the example was in this thread. My actual interest was more generally for accessing the context menu. Most recently I wanted to access Quick Actions > Convert Image and I just tested a macro to do that and it worked fine after I figured out the pauses needed.

Thanks again!

2 Likes