Working with apps whose "Copy" menu enabled although no word selected

Hello,

I have the macro (below) to work with the Mac Dictionary app.
My purpose:
If a word is selected, then copy the word and look it up in Dictionary.
If no word is selected, then just open the Dictionary.

Problem: In most apps, the "Copy" menu is disabled when no word is selected; the macro works great. But in Chrome, although no word is selected, the "Copy" menu is still enabled. Consequently, when no word is selected, the macro will be cancelled (instead of bringing the Dictionary window to the front).

Temporary solution (not ideal): For now, I add one more action (the Yellow action). When Chrome is the front app, it just brings Dictionary to front. But it will ignore any word selection.

Question: is there any other way to detect if a word is selected in Chrome? Or is there a better way to accomplish my purpose?

A side question: why is the "Copy" menu item enabled when nothing is selected?

Keyboard Maestro Actions.kmactions (7.2 KB)

For the Copy action, click the "gear" icon in the upper right. Turn off "Timeout aborts macro" and "Notify on Timeout". Then use "Set Action Timeout" (in the same menu) and set it to a small value, like one second, or even less.

After the Copy action, %ActionResult% will contain "OK" if the copy succeeded. So you can use an IF action something like this:

image

2 Likes

Hi @DanThomas,

This works for me!
Thanks a lot!

1 Like

Do me a favor and mark my post as the answer to your question, That way people will know the problem's solved. Thanks!

Thanks for the reminder. I confess that marking as solution is not built into the workflow in my mind yet.:sweat_smile:

1 Like