April 26, 2023, 4:57pm
I collect screenshots in my Keyboard Maestro Clipboard History Viewer.
I run into the situation where I want to save some of the prior screenshots to files.
Is there a way that I can select a screenshot in the Clipboard History Viewer and save that to a file?
Write a macro to write the image on the clipboard to a file.
Copy the image in the clipboard history viewer, and run the macro.
April 29, 2023, 1:20am
Thank you. If I understand you correctly that would get me partly there. Was hoping for something cleaner, like access any image in the clipboard history and use an action to write it to a file.
Cleaner is a relative thing...
In this case the only way to do the job (at present) with a modicum of hygiene is to employ a macro.
The write-text macro is the cleaner of the two, since the clipboard history window is unchanged when the macro is run.
Unfortunately the only way to acquire an
image for writing is to copy it to the system clipboard, and that act moves the position of the image in the history to the top – which also moves the selection in the window.
I'm a little surprised that System Events doesn't list the clipboard items by index.
Therefore I can't say “get index of first item whose selected is true”.
If I could do that I could restore the position of the selection after copying the image.
Unfortunately I'm not sure there's anything you can do to change that without altering the UI or making the history window scriptable...
Clipboard Filter trigger together with the Trigger Clipboard facility. Something like:
Ha! I forgot you could do that...
I wrote a pair of macros that employ
One is a filter as he mentions above.
Two is a macro that allows the user to activate macro one with a hotkey trigger.
Macro: Writing Keyboard Maestro Clipboard History Items to a File - #2 by ccstone
The hotkey trigger macro is a trifle slower than I like, because I have to resort to UI-Scripting with System Events – but it's not bad.
In any case it provides a smoother user experience than my first try.
Note – this method bypasses the [Close After Action] button setting of the Clipboard History Window. The window will always be left open, until the user elects to close it.