Player
Documentation
Frontier
User's Guide
Chapter 5, Verbs
One Verb Per Page
Player.chooseMenu
Syntax
Player.chooseMenu(menu, item)
Player.chooseMenu(menu, item, holding: modifierKeys)
Player.chooseMenu(menu, item, repeatUntilSuccessful: desiredState)
Player.chooseMenu(menu, item, holding: modifierKeys, repeatUntilSuccessful: desiredState)
Parameters
menu is either a name or position number.
item is either a name or position number.
holding: modifierKeys, an optional parameter, is one or more modifier keys (command, shift, option, control, caps lock) or their abbreviations (cmd, shft, opt, ctrl, caps), added together in any order.
repeatUntilSuccessful desiredState, an optional parameter, if true, Player will repeat the command until it is successful (or until the user aborts with command-period)
Action
Chooses a menu command.
Returns
True.
Examples
Player.chooseMenu("Edit", "Select All")
Player.chooseMenu("File", "Save As") « no trailing "..." required
Player.chooseMenu("Edit", 1) « works for either "Undo" or "Redo"
Player.chooseMenu("File", "FAX", holding: ctrl+opt) « labelled parameter
Player.chooseMenu("File", "Save As", repeatUntilSuccessful: true)
Errors
Menu or item does not exist or is not enabled; menubar is not available.
Notes
- If you get unexplained errors, see the separate Tech Support FAQ document. (You might also review the new setMenuSelectionLocation() verb.)
- The repeatUntilSuccessful parameter (new in Player 1.1) is useful when the prior operation in a script may take a long time and leave the menu bar unavailable -- e.g. because a progress bar is in front. Instead of trapping the error with "try" in a repeat loop, add this parameter to instruct Player to periodically attempt to select the menu, yielding processor time to other applications in between tries. This parameter is optional, there is no need to set it to false.
- The holding label may be left off, though the result may be less readable.
- e.g. chooseMenu("File", "FAX", option)
- This verb can also be used in place of chooseHierMenu(...). Player will determine whether the third parameter is a modifier key or a menu item
- e.g. chooseMenu("Edit", "Font", "Courier")
- For position number, be sure to count the separator lines.
- For nested hierarchical menus, use the form "submenu;subsubmenu".
- By default, Player matches only the number of characters specified in the verb parameter. This feature has the benefit of ignoring trailing punctuation, but will occasionally find a false match.
- By default, name matching is not case sensitive.
See Also
Player.chooseHierMenu
Player.menuExists
Player.getMenuInfo
Player.getMenuAttribute
Player.setDialogFolder
Player.setCompleteMatch
Player.setMenuSelectionLocation
Player.outlineMenus
Keywords
menus[1] modifiers version1.1parameter
choosePopup
Copyright 1993-99, PreFab Software, Inc. All Rights Reserved.
This site built and maintained using Stage Three, a set of custom Frontier scripts.