Pasted Items Don't Work as Write to File as PNG, and Snip/Screenshots to Clipboard Won't Work to Txt Files

snip save disk.kmmacros (2.5 KB)

image

I need something that can hold a snippet of an image or text and write it to a file.

Keyboard Maestro variables are strings, so

Clipboard -> KM Variable

is always a process which fetches only the string component of a clipboard, even when the clipboard may also contain data of other kinds, including .png etc.


Stepping back a bit, how would you broadly describe what you are hoping to do ?

1 Like

Hey Kevin,

Welcome to the forum!   :smile:

It looks like you want to save every text and image that comes through the clipboard, and that can be done.

I'm only going to show you how to handle an image.

You don't need to use AppleScript to rename your file, but since you did I stuck with it and embellished a bit.

Save Clipboard Image to Disk as PNG v1.00.kmmacros (8.3 KB)

Take note of:

That's all I have time for at the moment.

HTH.

-Chris

2 Likes

Oh yeah, you should also look at the File Actions action.

It's not intuitive, but moving a file is how you rename it.

This freaks out many Mac users, but it's old hat for Unix command line cowboys.

-Chris

Hey Kevin,

I note your macro group has to do with Clipboard History.

You are aware of Keyboard Maestro's built-in Clipboard History – yes?

See the Activate Clipboard History Switcher action.

It's not permanent like files would be, but it is non-volatile in that it survives reboots and such. Items fall off the stack as the maximum number of saved items is exceeded.

You can set the number of saved items in the Hidden Clipboard Preferences.

-Chris

1 Like

yes I just want backup because it takes a long to load if I have 500+ in the clipboard history

1 Like