I've been pulling my hair for three hours now, wondering why my sequential copy and paste script fails. Turns out that the KM clipboard history seems to filter out duplicates. If I want to use KM as clipboard manager, e.g. to copy and paste form entries where duplicates often occur, I need the clipboard history to be able to store duplicates.
Is there a hidden preference to disable the duplicate prevention? Ideally I could set a flag to change that behavior and turn it on and off, depending on the use case.
@peternlewis any chance to implement such a flag, or at least disable automatic duplicate prevention?
You could perhaps make a macro based on the idea of pushing to and popping from a stack.
Rather than choose new keystroke triggers, you might reassign Cmd-C/V/X for use with the macro – but be careful, and make the macro active only for this one application if you want to keep your macro as simple as possible.
I have found a forum post from 2016 which is relevant to this idea: Clipboard Stack Macros, by @Lantro. The author has kindly provided a rocking video to demonstrate it in use, too! I have not tried the macro.
Yes, something like this could work, but it is a complicated problem to solve. I'd rather not re-build something that is already built robustly into KM.
If you are writing a macro to copy things sequentially, then generally the best way is to copy each in to a variable (if it is plain text) or Named Clipboard. So
Copy
Set Variable “First Name” to “%SystemClipboard%”
Copy
Set Variable “Last Name” to “%SystemClipboard%”
Copy
Set Variable “Email” to “%SystemClipboard%”
As a bonus, that provides better documentation for what your macro is doing, as well as robustness for if you change orders of how you copy or insert the results.
I think for the use case you describe, where the structure is always the same, I would use a dictionary, just to decrease the number of variables floating around. For more unstructured data (as in my use case), an array variable will be a better fit.
Still a bummer that I cannot mix text and images, but that doesn't come up too often, thankfully.
Yes, but then I would need to know in advance how many images, and which image goes into which named clipboard, etc. I cannot create named clipboards on-the-fly and assign them values, or can I?
My source data might look like this:
text image text
image text
text text text
image image
...
And I need it pasted into another document like this:
text
image
text
image
text
text
text
text
image
image
...
Using JSON, I like it, thanks! That's why I love this forum, this might be just what I need, and I wouldn't have found it as quickly without your input