Using "Insert Text by Pasting" without destroying clipboard content?

Hey there,

is there a way to use the “Insert text by pasting” function without destroying the clipboard content?
i.e., if I have text “XY” in the clipboard, and then trigger a KM function that inserts “ABC” by pasting, afterwards the clipboard content is “ABC”. I’d like to preserve (or let KM restore) “XY” so I can still use the clipboard content from before the KM function trigger.

Thanks!
Daniel

Follow it with a “Delete current clipboard” action, which is actually a “Delete past clipboard (0)”. This will delete the current clipboard value from the clipboard history stack, and pop up the previous value.

You will probably need a slight pause before the delete, because the paste function doesn’t necessarily finish instantly.

1 Like

Also read the FAQ Why is the clipboard not restored after any clipboard action? to understand the consequences of restoring the clipboard.

1 Like

Thank you guys. I’ll test that tomorrow.
I’d use “Insert text by typing” instead, but that is so slow, even on a fast computer, that when I type quickly, the result is almost always messed up in some way.

E.g. when “br” expands to "Best Regards and I quickly type “br[Enter]”, the newline created by Enter keypress will be somewhere inside the string “Best regards” instead of at the end.
I haven’t found a solution for that kind of issue. I could imaging some queueing mechanism that blocks direct processing of keystrokes while such an action is executed, but insteads queues them and executeds them after completed execution of the typing action. Is there something like this that I may have overlooked?

Thanks!

No. The system has its own queue of events and keys from the keyboard or keys from Keyboard Maestro go into the queue, and there is no way to defer the former while doing the latter.

@peternlewis - small note, there’s a typo in that FAQ entry. “you can get the old value ack from the clipboard history.” I think that should be “back”.

1 Like