SelectMenu


 

SelectMenu>WindowTitle,MenuIndex[,SubMenuIndex[,SubMenuIndex[,...]]]

 

Selects the menu item specified by MenuIndex and optional SubMenuIndex parameters of the window specified by WindowTitle.

 

MenuIndex and SubMenuIndex are integer numeric values.  For MenuIndex 0 is the first menu item on the left of the menu bar, 1 the next and so on.  For SubMenuIndex, 0 is the first item in the submenu, 1 the next etc.  The index includes separating lines, so remember to count them.

 

For example, to select the Save submenu item in Notepad, Save is the 3rd Submenu item of the File menu.  The File menu is the 1st menu item in the menu bar.  So MenuIndex is 0 and SubMenuIndex is 2.  There are no further submenus.  So the command would look like this:

 

SelectMenu>Notepad*,0,2

 

WindowTitle can contain the asterisk wildcard to indicate that it is a substring search (See SetFocus for more explanation).  If the WIN_USEHANDLE variable is set to 1 WindowTitle must be a window handle rather than window title.

 

Abbreviation: MNU

 

Note: SelectMenu only works with standard Windows menus.  Many menus are now in fact custom built menus that are other controls made to look like menus.  SelectMenu will not therefore work with these objects.

 

WindowTitle can end with an asterisk to indicate a substring match.  WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted.  See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.