Problem with macro to edit named clipboards

Hello, I use named clipboards to store all kinds of info that I frequently have to consult.
I wrote this macro to quickly access / edit named clipboards but it does not work.

What I tried after opening KM Settings:

  • AppleScript below generated with UI Browser
  • click at found image

Thank you very much

Engine Console error message
2024-05-12 07:01:00 Execute an AppleScript failed with script error: text-script:65:144: execution error: System Events got an error: Can’t get window "Preferences: Clipboards" of process "Keyboard Maestro". (-1728). Macro “Edit Named Clipboard” cancelled (while executing Execute AppleScript).

Edit Named Clipboard.kmmacros (45.5 KB)

view ScreenShot macro (click to expand/collapse)

If you're on KM11, you can use the Press a Button feature to click the button. It's just a bit tricky to get it to scan the Settings window because it wants to scan the front window of the app you select. To get around that, open Settings such that you can still see the macro itself, and in particular, the Button menu in the Press Button action.

Hold down the Command key (with Settings frontmost) and you can activate that menu item to have it scan the frontmost window in Keyboard Maestro without the editor window coming forward. I'm explaining this to show you how I got this macro, which appears to work, so you can do it again in the future if need be :).

Download Macro(s): Open Clipboards in Settings.kmmacros (2.2 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.4.1
  • Keyboard Maestro v11.0.2


1 Like

I'm 100% sure you already know this Rob, but I'll mention it anyway.

Wouldn't it be more robust AND faster to replace the Pause statement with this...

One reason to use this method is that there are so many kinds of Macs, that not all of them will require the Pause to be 0.2 seconds, and some might require a longer value.

If anyone uses this method, I recommend changing the default timeout value for this new action from 99 hours to something shorter, perhaps 5 seconds. But then you could argue that 5 seconds might provide the same problem as 0.2 seconds. Touché!

EDIT: I just remembered the Press action has a new option that's called "Wait for Enabled Button" which would do the same thing as what I'm recommending above...

Screenshot 2024-05-12 at 04.19.45

And it would look like this... (notiuce the words "When Enabled")

It definitely would — I read this thread late last night (for me :)) ) and had a thought that you could maybe use the Push a Button action, and that's what I tossed together to try it in a hurry. Definitely wait until is much better!

And even better, I forgot that option was in the Gear menu. Best of all!


@griffman works perfectly. thanks very much

@Airy wait until enabled: very smart idea ! thanks very much ! I did not know about it.

You can open the KM Settings "Clipboards" pane with a one-line AS:

tell application "Keyboard Maestro" to show preference pane "Clipboards"

fantastic. I had tried with no success with chatGPT. thanks very much !