Detect CMD-C with no selection?

I’m using a macro to copy selected text to the clipboard for manipulation and then paste it back in place. I wanted to know if there’s a way to detect that the copy to clipboard failed… like when there is nothing selected, you just get a system beep, because nothing was selected to put into the clipboard. I’m looking for a way to detect that and stop the macro from proceeding. Any ideas?

I ended up doing something like this:

  • Set variable to %CurrentClipboard%
  • Type CMD-C
  • If
    clipboard IS %Variable%OriginalClipboard%
    Cancel this macro
  • Else
    Do the macro

Is there a better way?

There is nothing wrong with what you’re doing. Typically, I’d do something like:

  • Set Clipboard to “KM-NONE”
  • Command-C
  • If clipboard is not “KM-NONE” …

Alternatively, you can use the If condition to determine if the Copy menu is enabled first.

  • If menu with shortcut Command-C is enabled
    • Command-C …