Select or Show a Menu Item action issue with Sonoma

I have a macro that uses the "Select or Show a Menu Item" action to open a submenu in an application that doesn't have a keyboard shortcut for that (Family Tree Maker > File > Backup...). It has been working for years. Today I upgraded to Sonoma and it doesn't. I made a test macro and tested it with a number of apps and various menu items. In all cases the main menu is selected eg "File" and the list of submenus appears but the requested submenu is not selected (I tried in Finder, Notes, Safari.. all the same). What can I try to make the menu selections work?
Test Menu selection with Sonoma.kmmacros (19.2 KB)

I'm having a similar issue

Glad I am checking into whether there are issues with Sonoma before upgrading. Usually I just jump in to any upgrade with both feet and regret it later.

I believe Apple rewrote the menu system entirely for Sonoma, so I guess its not surprising that there are a few rough edges.

I've seen reports of some menu items returning errors when they are selected:

I wonder if this is related to that issue.

OK, yes, this is basically the same issue.

Sonoma for some (all, many, most, a few, I'm not sure) menus returns error -6520 menuNotFoundErr for menus it clearly finds. So selecting Safari File ➤ New Window, works, but then returns menuNotFoundErr. And trying to shoe Safari File ➤ Export fails with the same error.

So I would guess Apple has to work to do to resolve this. It's pretty repeatable, and the menu system is all new, so hopefully they will actually resolve it. Otherwise eventually I'll have to consider ignoring the error (if that is possible for all cases). But hopefully Apple will do the right thing and get this fixed.


Thanks. I can adjust my macro so that it starts after the appropriate dialog box appear... and I'll keep my fingers crossed that Apple fixes the issue soon.

Just an update, the system actually reports error code -25205, kAXErrorAttributeUnsupported from the AXUIElementPerformAction API. Keyboard Maestro uses the menuNotFoundErr for display purposes after it encounters the error in selecting the menu.

For what it's worth, I have a similar macro that's actually working better on Sonoma. In this case, I have a Select Menu Item action targeting a menu hosted by a menubar app (Airfoil Satellite). In Ventura this action did not work on its own, but required a "Click at" action following it that targeted the image of the menu itself. To get this second action to work consistently, I had to turn on the macOS option "Reduce transparency".

After upgrading to Sonoma, I noticed when I ran the macro the desired action occurred, but the menu was left displayed on the screen. I disabled the second action in the macro and voila, the macro kept working but the menu was no longer left on the screen. This meant I could turn off "Reduce transparency," which I did.

So if Apple did rewrite the menu system in Sonoma, in this case the change was KM-friendly. :slight_smile:

1 Like

Comme je comprends mal l'anglais, j'écris en français.
Pour éviter d'utiliser le menu Imprimer dans les macros, j'utilise une keystroke

et ça marche.

Translation :slight_smile: As I don't understand English very well, I write in French.
To avoid using the Print menu in macros, I use a keystroke

and it works.

There are actually 2 related problems with Sonoma:

  1. As pointed out by Peter and others, menu selection generates spurious errors, causing one to simply turn off error checking on menu selections.
  2. Second problem: KM's "Select Menu" cannot treat a "submenu" as a "menu item". A submenu CAN be treated as a menu item on Ventura, so It works fine on Ventura and probably earlier versions. Unfortunately, if you try to select a submenu as a menu item, it fails, but because error checking is turned off due to the first problem, you cannot catch the error.
1 Like

The update to KM 11.0.1 has fixed the specific issue I had with the submenu selection and my macro is now back to work.... I did have to add a 0.2 second pause after the "Select menu. " action before the next action (copy) but all in all a good fix. Thanks much