Append multilple copy to clipboard

there is a way to add more copy actions to the clipboard and then paste them all together ?

1 Like

Hey Enrico,

Hm. There's not an append-to-clipboard action, so lets make one.

This macro appends selected text to whatever else is on the clipboard and puts a linefeed between the original and the appended text, although you can change that to anything you wish. You can also trim any extraneous whitespace. There are many choices available.

-Chris

[I have changed the *macro file* to reflect Peter's comments below, but I have left the image intact - so people can understand what he's saying and learn from my mistake.]

Append to the Clipboard.kmmacros (4.8 KB)

1 Like

I like this macro, but for reference, both of those pauses are useless, though for different reasons.

The first one is useless because the Copy Clipboard action is entirely synchronous. After it completes, the copy has taken place, so the pause does not accomplish anything. About the only possible exception to this would be if you copied to the system clipboard, and then immediately did a Command-V, and if the application had clipboard caching, and that caching was particularly bad.

The second one is useless because by the time it is pausing, the activity has completed, and if the pause was needed, it would already be too late. Copy to Named Clipboard is essentially identical to:

Type a Keystroke: Command-V
Pause
Copy Clipboard: System Clipboard to Named Clipboard

As above, that Copy Clipboard part is synchronous. The asynchronous part is the Type a Keystroke, which posts the key onto the event queue, and eventually the system/application process it and set the system clipboard, hence the need for a pause. By the time the action has completed, it has finished copying the system clipboard to the named clipboard, and even if the data was stale and a longer pause would help, its too late.

Of course, all of this adds only 0.2 seconds to the macro execution, so you’ll never notice, but it also adds complexity to the macro. And while pauses are too often required, Keyboard Maestro really does try to ensure the action is complete before continuing the macro.

brilliant solution, thanks

Wow, this is so awesome. I’m going to share it on my Mac Automation Tips blog. I think many could find use for this.

Several years later, I'm wondering if this great macro can be modified to clear the clipboard after pasting the appended items accumulated by the macro. I've tried everything I can think of, but I can't make that happen. Let me explain, and I hope this will be clear: If I append six words from document 1 and then paste them into document 2, then go back to document 1 and append three more words, then go back to document 2 and paste, I'm pasting the three new words plus some or all of the previous six. Is it possible to delete the previous six from the clipboard after I paste them in document 2 so that the clipboard is empty for the three new words, and on and on ad infinitum? Thanks so much for any suggestions, and please let me know if I'm not making sense.

Hey @kerjsmit,

Create a paste and delete macro that:

Like this:

Append to the Clipboard -- Paste and Clear v1.00.kmmacros (4.3 KB)

You can use this to clear the clipboard before starting to append as well.

-Chris

Thanks so much @ccstone, that works great. It adds a blank line before the next paste, but I think I can figure out how to adjust for that. Thanks again!