Function Reference


WinMenuSelectItem

Invokes a menu item of a window.

WinMenuSelectItem ( "title", "text", "item" [, "item" [, "item" [, "item" [, "item" [, "item" [, "item"]]]]]] )

Parameters

title The title/hWnd/class of the window to select the item. See Title special definition.
text The text of the window to select the item. See Text special definition.
item Text of Menu Item
item [optional] Text of SubMenu item
item [optional] Text of SubMenu item
item [optional] Text of SubMenu item
item [optional] Text of SubMenu item
item [optional] Text of SubMenu item
item [optional] Text of SubMenu item

Return Value

Success: 1.
Failure: 0 if the menu is not found.

Remarks

You should note that underlined menu items actually contain a & character to indicate the underlining. Thus, the menu item File would actually require the text "&File", and Convert would require "Con&vert" You can access menu items up to six levels deep; and the window can be inactive, minimized, and/or even hidden.

WinMenuSelectItem() will only work on standard menus. Unfortunately, many menus in use today are actually custom written or toolbars "pretending" to be menus. This is true for most Microsoft applications.

Related

ControlCommand, Send

Example

; This will select File and then Page Setup in notepad

WinMenuSelectItem("[CLASS:Notepad]", "", "&File", "Page Set&up...")