Saved Clipboard (Named Clipboard?)

Reading the documentation about the Name Clipboards, it seems that it doesn't allow all files or anything we want. And judging by the simple panel inside Preferences/Clipboards, I think it's indeed limited to certain things.

Here's what I want to do: I have this file that's 200MB and I would like to save it as a clipboard "element" that I can then easily paste by just using the Trigger Macro by Name. So I would just basically go to the Finder window I want, Trigger Macro by Name, find the macro that would find and copy that file and hit Enter to paste it there.
I tried dragging it to the clipboard panel, but KM just stopped working, so that's not the way to do it, I guess...

Is the Named Clipboard what I should use? If not, how can this be achieved (if possible at all)?

I figured it out by watching this video:

It seems that I needed to save the path inside the panel, instead of dragging the file itself. @peternlewis maybe dragging and dropping a file to the panel could automatically create the path?

What action are you using?

I think if I had a 200MB image that I wanted to insert, I would just use:

I wouldn't want the 200MB file stored anywhere in Keyboard Maestro generally.

1 Like

This suggestion was for the Clipboards panel inside Preferences. When you drag a file there, it would create the path to the file. Right now it seems that's reading the file itself and that's why a 200MB file crashed KM (I guess).

This is not an image. It's a Logic file.
I tried the Read a File action, but it seems that's limited to text and images, right? At least, that's what's mentioned on that article you shared. I got an error:
image

Is there a similar approach, but for any type of file without KM storing that file?
All I need is KM to find a file in Finder, copy it to the System Clipboard, then paste it and, as you suggested, remove it from the clipboard.

@peternlewis I think I found the answer. Can you please confirm if this is the right way to do it? I'm not an AppleScript expert (not even a beginner I would say) so I can't say if this is the right approach...

Following this suggestion: Copy Finder File to Clipboard - #4 by CJK and an Apple Forum suggestion, I came up with this script:
image

Can you confirm this script is correct? It's working and it pastes the file, but just wondering if it's well written, because I merged 2 different suggestions into 1.

Then my whole macro is this:
image

It shouldn't crash Keyboard Maestro, but it's not a good idea.

I couldn't store a file reference at that point, since that is not the expectation for a clipboard or an image from a drag, the expectation is that it is stored as the data contained in the drag, not a reference to something that might change later.

Beats me. It looks ok, but I'm no AppleScript expert.

You probably don't need to delete the clipboard if it is just a file reference.

I was saying this, because when I used the action to paste to named clipboard, I got the path to that file. At least that's what I get (visually speaking):
image

So I was assuming it was just copying the path.

I just want this to be a temporary clipboard item so if I already copied some text, for example, before moving the file, I will still have that text available as my item 0 once the file is moved.

1 Like

Paste it where? If this is in the Finder, you might find the "Move or Rename a File" with its option set to "Copy" to be faster.

1 Like

Not that there's anything wrong with AppleScript, but Keyboard Maestro runs it a trifle slowly – so you'll get better performance from something like this.

-Chris


Copy Template Path to the Clipboard v1.00.kmmacros (6.3 KB)
Keyboard Maestro Export