Choose menu item by name
Finds a menu item anywhere in an app's menu bar by its name and chooses it, or lets you pick one from a list.
Choose menu item in app
Keyboard Maestro: SelectMenuByName
Details #
Searches the whole menu bar of an app, submenus included, for an item whose title matches text, and chooses it. You do not need to know which menu it lives in. When you do know the path, Choose menu item is more exact.
The match tries, in order: the exact title, a title that starts with the text, then a title that contains it. Case, surrounding space and "..." versus "…" are ignored. Only enabled items are chosen. The search goes up to six menu levels deep.
If text is empty, the step lists every enabled item as "File ▸ Export…" and asks you to pick one.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
app | text | The app whose menu bar to search. Without it, the front app. | ||
text | text | The menu item's name, or part of it. A whole path such as "File ▸ Export as PDF…" names exactly that item. Empty shows a list to pick from. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Choose the menu item “Save”
- Show “Menu item chosen”
Gotchas #
A partial name picks the first match in menu order, which may not be the one you meant. Use the full title when several items share a start.
An item that is greyed out fails with "X is greyed out. It may need a document open or something selected first."
When nothing matches, the failure reads "No menu item called "X"." with a list of titles found and a "Did you mean" suggestion.
Fails with "the app has no menu items to choose from" if the list is empty. If you dismiss the list, "cancelled by you".
Needs Accessibility permission. A dry run only simulates this step; it searches no menus and chooses nothing.
The list for an empty
texthas the usual 10 second step limit. Set a longertimeouton the step if you need more time to choose.
In the palette #
Press ⌥Space in any app and type part of a menu command, such as "export" in Safari. Rows under "Menu items" read "File ▸ Export as PDF…" with the app's name under them, at most five. ⏎ chooses the item, the same way this step does. ⌘⏎ makes a macro for it ("Safari: Export as PDF…", with a menuByName step, run only while that app is in front) and opens it with the hotkey recorder listening, so "I keep doing this" becomes a hotkey. Turn the rows off in Settings › Palette.
The output holds the menu path that was chosen, such as "File ▸ Save".