Player
Documentation
AppleScript
User's Guide
Chapter 5, Verbs
One Verb Per Page
do menu: choose from a pull-down menu
Syntax
do menu menu item nameOrPosition of menu nameOrPosition [of submenu nameOrPosition] [holding modifierKeys] [repeat until successful desiredState]
Parameters
menu item nameOrPosition -- name or position number (counting menu dividers) of the menu item
of menu nameOrPosition -- name or position number of the pull-down menu
[of submenu nameOrPosition] -- name or position number (counting menu dividers) of the submenu
[holding modifierKeys] -- one or more modifier keys (command, shift, option, control, caps lock), concatenated with "&"
[repeat until successful desiredState] -- if true, Player will repeat the command until it is successful (or until the user aborts with command-period)
Result
true
Examples
do menu menu item "Select All" of menu "Edit"
do menu menu item "Save As" of menu "File" -- no trailing "..." required
do menu menu item 1 of menu "Edit" -- works for "Undo" or "Redo"
do menu menu item "Courier" of submenu "Font" of menu "Format"
do menu menu item "FAX" of menu "File" holding control & option
do menu menu item "Close" of menu "File" with repeat until successful
Notes
- If you get unexplained errors, see the separate Tech Support FAQ document. (You might also review the new "set menu selection location" verb.)
- The repeat until successful 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.
- AppleScript turns "repeat until successful true" into "with repeat until successful". This parameter is optional, there is no need to set it to false.
- 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.
Errors
Menu or item does not exist or is not enabled; menubar is not available.
See Also
exists menu
get info menu
set dialog folder
set complete match
set menu selection location
do menu popup
Copyright 1993-99, PreFab Software, Inc. All Rights Reserved.
This site built and maintained using Stage Three, a set of custom Frontier scripts.