How to `insert text by pasting` and not have it in clipboard after

I have above macro.

I want same macro but I don't want console.log() in my clipboard after. How can I do that?

I can't use insert text by typing, I need pasting specifically as I am solving this issue with it

And insert by typing is breaking there too.

I tried to find an action to pop item from clipboard but did not find it. Is there a way to do it?

Thank you.

Ok I found this

I guess thats the official solution right?

Yes, kind of. Although you will want to delete Clipboard 0 (not 1) as 0 is the current clipboard. You might also want to have a slight pause before deleting to give the System Clipboard time to catch up. You can also have the pause wait for the Clipboard to change, something like this:

EXAMPLE Restore Clipboard by Deleting.kmmacros (3.0 KB)

Click to Show Image of Macro

Another method is to save the System Clipboard before you do the paste to a Named Clipboard and then restore that Named Clipboard to the System Clipboard:

EXAMPLE Restore Clipboard using Named Clipboard.kmmacros (2.7 KB)

Click to Show Image of Macro

3 Likes

It also makes a great subroutine. Define your clipboard management in one place and pass it what you want to paste.

2 Likes

Hi @Zabobon,

Wow! Thanks so much for this tip. I had no idea about the CLIPBOARDSEED function.

I have spent hours today trying to figure out why my macro was behaving so inconsistently when retrieving a system clipboard value or when retrieving a variable value that was set from the system clipboard. I even added a pause of 1 second after the copy action but the results were still inconsistent. I actually thought there was something buggy going on.

But I saw your post and decided to try your tip about making sure the copy action is valid only when the CLIPBOARDSEED value has been updated. Then everything started working perfectly. This should be documented somewhere.

So glad I came across this post. :slight_smile:
ChrisQ

1 Like