EDIT by @_jims, 2022-01-07:
The version of the macro I posted previously had a bug. The use cases tested are:
ABC
XYX
- ABC (or XYZ) in Clipboard, no text selected, trigger macro, paste text.
- ABC in Clipboard, XYZ selected, trigger macro, paste text.
- XYZ in Clipboard, XYZ selected, trigger macro, paste text.
The previous version of the macro failed the third use case.
I've updated this post with a corrected macro. I apologize if the previous version caused confusion.
Hi @rowan. I was working through this very issue when I was developing a macro named Augment or Filter Text. I discovered a few nuances during the process.
Here's a simplified macro that includes the relevant actions.
DOWNLOAD Macro File:
Get Selected Text- Otherwise Clipboard v1.1.kmmacros (16 KB)
Note: This macro was uploaded in a DISABLED state. It must be ENABLED before it can be run. If it does not trigger, the macro group might also need to be ENABLED.