Method WinMenuSelectItem

AutoIt X

Method Reference


WinMenuSelectItem

Invokes a menu item of a window

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

Parameters

title The title of the window to read.
text The text of the window to read.
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: Returns 1.
Failure: Returns 0 if the menu could not be 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|" 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


Set oAutoIt = WScript.CreateObject("AutoItX3.Control")

' This will select File, Page Setup in notepad
oAutoIt.WinMenuSelectItem "Untitled - ", "", "&File", "Page Set&up..."