Copy Finder File to Clipboard

Continuing the discussion from Working with the Finder Selection:

Is there a way to copy a pdf at a file path into a Keyboard Maestro clipboard so I can paste it in to an email in Apple Mail? I command+c the file and command+p which of course work in the Finder and then Apple Mail. The file is the same

Hey @skillet,

Have you actually tried copying a file to a named clipboard and then pasting back out from it?


Use the Read a File action to read the PDF into the clipboard, then Paste in Mail will work, although it will only get the first page into the email.

If there isn't already a message window open in which you wish to paste the PDF file, you can create a new message that contains the PDF file as an attachment like so:

If the message into which you wish to paste the PDF file has already been created then, assuming it is the front window within the Mail application, I believe this should work:

1 Like

My apologies for the delay @CJK that is awesome both work like magic the latter one is the one I was after! This will be helpful for so many other things as well! Thank you very much!!

I had but I it wasn't going to a clipboard I guess I didn't know how to properly get it to the clipboard through a file path. That AppleScript that CJK had did the trick.

1 Like

I used Read a File to read a image file to clipboard, but the 200KB image file (size on disk) became 2.2MB image on clipboard which made my email extremely large so that I couldn't send it out. Is it a bug?

image on disk
Image Size on Disk

image on clipboard read by action "Read a File"
Image Size on Clipboard Read by Action "Read a File"

Image size will depend on how it is represented. I don't know what that second image is supposed to be. Keyboard Maestro generally deals with images as tiff’s, which being lossless will generally be much larger than jpegs. But mail clients can and do adjust the image as well (Mail has a settings for how much it compresses your images for example).

Is there any way that deal with images as jpeg? The outlook doesn’t have auto-compressing feature. Tiff will make my mail main body too large to send.
2019年5月17日 +0800 17:10 Peter N Lewis,写道:

This is a known issue. The KM Read File action converts all image files to tiff format on the clipboard. For a workaround, see:

Feature Request

@peternlewis, could you please change the Read File action to use the same image format as the source file? So if the image file is a "png", that is the format that will be placed in the variable or on the clipboard.

Almost no one uses the tiff format these days. :wink:


tiff is what the system natively supports for this purpose.

I don't have any near term plans to support different behaviour I am sorry to say.

OK, no problem. Until/if you do, Chris @ccstone has provided us with a very nice workaround.
It would be great if someone could convert Chris' script into a KM Plugin.

1 Like