MenuSelect Method (AnyWin)

Class

AnyWin class.

Action

Selects an item from a popup menu that is not implemented as a distinct window and that appears when a user presses mouse button 1 (by default, the left mouse button) at a certain location within a window (such as a tool bar).

Availability

This method is supported only in scripts that use the Classic Agent. For scripts that use the Open Agent, use the OpenContextSelect method.

Syntax

window.MenuSelect (iXpos, Ypos, sItem)
Variable Description
iXpos The horizontal coordinate (relative to window) at which to press the mouse. INTEGER.
iYpos The vertical coordinate (relative to window) at which to press the mouse. INTEGER.
sItem The item to select. STRING.

Notes

MenuSelect selects an item by pressing mouse button 1 at the specified coordinates of window, then selecting sItem from the popup menu that displays.

It is important to hold down the Shift key while exposing and picking menu items.

You can use MenuSelect wherever pressing mouse button 1 displays a popup menu. For example, some Microsoft applications, such as Internet Explorer, have a kind of toolbar—called a CoolBar—where the menubar usually appears. The toolbar has flat buttons that look and act like menu items. When you press one of the buttons on the toolbar, a popup menu displays. Use MenuSelect to select an item on the popup menu.

After selecting the item, Silk Test Classic verifies that the item was selected, and raises the exception E_CONTROL_NOT_RESPONDING if it was not.

Example

MainWin.MainToolBar.MenuSelect (88, 9, "Source")