I want to overwrite the clipboard instead of appending to it

When triple-clicking to copy a Wikipedia title etc, normally triple-clicking will include the line breaks, so I created the following macro to copy without the line breaks.

This successfully removed the line breaks.

However, when I look at my clipboard history in another app (Alfred), I see two copies remaining: one with the line breaks removed, and one without the line breaks, as shown in the image below.

I don't need copies with line breaks in them at all, so I'd prefer they don't even remain on the clipboard.

Does the "Search and Replace action" only allows us to append like this, rather than actually replacing?

Thank you.

Hi!

You can manually solve this by adding this action to the end of your macro:

Delete Past Clipboard.kmactions (377 B)

Keyboard Maestro Export

Past Clipboard 0 would mean current system clipboard entry, Past Clipboard 1 is the first of the past clipboard entries.

1 Like

Thank you Alexander, I tried it. But for some reason, there was no change and the problem could not be solved...

It's exactly what you said action, and I've set the number to 1.

For reference, even when I entered 0, two histories still remained.

Hmm, this sounds like strange behaviour to me, I do not see why that would not work.

How does your clipboard history look after running the macro bellow?

Delete past clipboard TEST.kmmacros (16 KB)

1 Like

So, if you are checking past Clipboards in Alfred it will be copies in Alfred’s Clipboard history not copies in Keyboard Maestro’s Clipboard History.

The Mac does not have a clipboard history. The Mac’s clipboard only holds one item.

So, deleting past Clipboards in Keyboard Maestro will only delete its copies.

If you want to delete Alfred’s copies presumably you would need to do that in Alfred itself.

4 Likes

Ah, of course, this makes sense!

2 Likes

Alexander and Zabobon, thank you very much for your reply.

I tried Alexander's test macro and, as Zabobon said, it worked fine with Keyboard Maestro's clipboard but not with Alfred's.

And Zabobon told me the reason why.
OK thank you very much.

1 Like