1

I'm talking about Mac OS X. Can I count the amount of menu items currently displayed for the active window? Can I get their text? Thanks.

Aleks N.
  • 6,051
  • 3
  • 42
  • 42

1 Answers1

0

Yes, using the accessibility API.

LaC
  • 12,624
  • 5
  • 39
  • 38
  • 2
    And [the docs for doing this for any application's menus](http://developer.apple.com/library/mac/documentation/Accessibility/Reference/AccessibilityCarbonRef/). – Peter Hosey Jul 05 '11 at 09:08
  • Thanks! Do I understand it correctly, that I need to invoke [element accessibilityAttributeValue:NSAccessibilityChildrenAttribute] and then go through the elements ask them for their role using [child stringValueForAttribute:NSAccessibilityRoleAttribute]? – Aleks N. Jul 05 '11 at 12:26
  • Here is also some useful piece of technique: http://stackoverflow.com/questions/6178860/getting-window-number-through-osx-accessibility-api Thank to all of you guys! – Aleks N. Jul 05 '11 at 12:32
  • Updated [link to the docs](https://developer.apple.com/library/content/documentation/Accessibility/Conceptual/AccessibilityMacOSX/) – Rob Keniger Mar 16 '18 at 02:01