tags:

views:

117

answers:

1

When you press the keys for an NSMenuItem keyboard shortcut on Mac, the menu itself highlights to indicate that an action in that menu has been activated.

If you are not familiar with the effect try it now by selecting some text and while pressing CMD-C, watch the Edit menu. It will flash blue to indicate you activated a shortcut for an item in that menu.

I want to achieve the same effect programmatically, preferably without faking the keyboard entry. Thanks for your time.

+1  A: 

Use the Accessibility framework. Find the menu item and send it an AXPress action.

Peter Hosey