Problem With Copying Selected Text


KM version 10.2. MacOS version 12.5.1

I just little bit edited simplest default macro in KM, but it do not work often. So I select some text using mouse or ⌘A and then hit hotkey trigger, but instead of firstly copying it just paste previous content of clipboard. If I change ⌘C on Copy action then often I will get "timeout exceeded" error and nothing happens. I just completely cannot understand what's wrong. Sorry if I can't see something simple I just started using this program.

UPD: Looks like somehow it conflicts with some other hotkey (I thought KM override every other app). So I just changed hot key trigger to another. Then it works more often BUT also quite often it just skips copy step and pastes previous content of clipboard. I don't know why.

And what is even more strange — I have another macro which starts from Copy action and then it pastes text in some field on site and it works ALWAYS.

Welcome to the foum.

Try starting with a short pause 0.3 sec. before the copy. Check also the timeout setting behind the cogwheel of the COPY action

1 Like

Or / and try to activate the ⌘+c via the menu.

Thank you very much for suggestion! It definitely works much better after I inserted delay 0.3 before Copy action. But still if I do it rapidly with many sentences in a row I got timeout error on Copy action. What's wrong with it? I have MacBook Air M1, it can't be hardware issues. And as I said I have another workflow which starts with Copy action but no problems with it at all.

Well, I work with OmegaT, there is no Copy in Edit menu )

Try to use the other workflow macro (which works as desired) as template for the workflow you have problems with.

I did exactly that.

Try inserting this action (Pause Until Change) after the copy action.


Do you mean the "Copy" action, or do you mean "Keystroke ⌘C" as you are using above?

Don't forget that KM has a proper "Copy" action, which has it's own "wait until clipboard changes" so you don't have to do that yourself. You might still have to put a pause before it, though -- especially for not-very-Mac-like apps (which will include OmegaT if it hasn't got "Copy" in the "Edit" menu!).

Your macro is probably out-running the software. Start by putting longer pauses, like one second, between every action. If the macro works consistently start reducing them and you should soon find where the bottleneck is. You can then find a better way to wait than a hard-coded pause, like "Wait until menu item x is enabled".

It only returns everything to previous step. Your first advice is best for the moment.

Now I work with Copy action, before I also tried ⌘C which worked better than Copy action. But after this advice about delay for 0.3 sec Copy action works fine most of the time (except very rapid pace of copy paste which I don't really need).

Yes I also thought that it must be at least partly related to OmegaT, but I also had problems with truly mac apps like Drafts albeit fewer. Yes I understood that I should experiment with Pause. I just can't understand logic behind starting macro from Pause. Pause between action understandable but not before ALL actions, in the very beginning.

And I didn't have even one problem with this macro, which also starts from Copy and I use it mostly in OmegaT.

Hey @Gyaltsen,

Microsoft (and some other) apps have proprietary clipboards that impede Keyboard Maestro's ability to work with them.

Sometimes the only way to reasonably overcome this is to:

  • Copy your text.
  • Switch to another app.
  • Process the text with Keyboard Maestro.
  • Switch back.
  • Paste

Switching away from the original app usually forces it to copy its proprietary clipboard to the actual System Pasteboard.

Depending upon the app you're working with and the size of the text you're copying and processing you may need to adjust the sleep interval in the shell script action. Currently it's set for 1/10 of a second.


Fix Clipboard After Copy in Microsoft Applications v1.00.kmmacros (8.1 KB)
Keyboard Maestro Export

1 Like