Collecting keyboard shortcuts for menu items of another application

142 Views Asked by At

I'm writing an application that allows access to other applications' menu items via the accessibility framework. I have no problem obtaining the list of menus, their menu items, etc..

As far as I can see, however, the accessibility framework does not give access to the keyboard shortcuts for each item.

More concretely, if my app presents the Finder's File -> New Finder Window menu item, I would like to annotate it on screen with Command-N, so the user can learn the shortcuts by heart.

At the moment I see no way of getting that information. If not via the AXUIElement accessibility framework, how else can one get that info?

Any help would be much appreciated.

1

There are 1 best solutions below

0
Frank R. On

I have managed to find AXMenuItemCmdChar and associated AXUIElement attributes that actually have the information I'm after. Unfortunately, the Swift framework that I use to bridge the C-level Carbon accessibility APIs defines a convenient enum for all the attributes.. only it's not quite all the attributes :-(