Click on Menu

Verb: clickOnMenu

Clicks on menu items in an open window.

Syntax

clickOnMenu --window(Window) --menupath(String) [--timeout(TimeSpan)]

Inputs

Script Designer Required AcceptedTypes Description
--window Window Required Window Open window in which the menu is clicked.
--menupath Path Required Text Text with the sequence of menu items that are clicked.
Each item clicked on the menu must be separated by a line break.
--timeout Timeout Optional Time Span, Number, Text Command execution timeout.
If no value is defined in the timeout parameter, the execution uses the context time defined by the Set Timeout command. If the script does not use that command, the default time is 5 seconds.

Example

Example 1: A Notepad application window opens. The Click on Menu command performs the following sequence of clicks in the menu: File->Open, which opens a new window for selecting a file.

defVar --name notepadWindow --type Window
defVar --name processId --type Numeric
defVar --name success --type Boolean
launchWindow --executablepath "C:\\Windows\\notepad.exe" --timeout 00:00:20 notepadWindow=value  processId=processId success=success
clickOnMenu --window ${notepadWindow} --menupath "file\r\nopen" --timeout 00:00:10

Example 2: Similar to the previous example, however, to go through the menus several times, several executions of the Click on Menu command are necessary.

defVar --name notepadWindow --type Window
launchWindow --executablepath "C:\\Windows\\notepad.exe" --timeout 00:00:20 notepadWindow=value
typeText --text "IBM"
clickOnMenu --window ${notepadWindow} --menupath "edit\r\nselect all" --timeout 00:00:10
clickOnMenu --window ${notepadWindow} --menupath "edit\r\ncut" --timeout 00:00:10
clickOnMenu --window ${notepadWindow} --menupath "edit\r\npaste" --timeout 00:00:10
clickOnMenu --window ${notepadWindow} --menupath "file\r\nsave" --timeout 00:00:10
// Write, select, cut and paste text and open the save file window.

In order for both scripts to work, the Notepad must be in English, as the command identifies what menu item should be clicked by name. Should the notepad language be any other than English, the menu path in the Path should be changed accordingly

See Also

  • Attach Window
  • Cancel Token Source
  • Clear Cache
  • Click
  • Click on Cell
  • Click on Value
  • Close Window
  • Control Screenshot
  • Count Windows
  • Expand Tree
  • Find Window
  • Find Windows
  • Focus
  • Focus Window
  • Get Barcode
  • Get Bounds
  • Get Cell Value
  • Get Control
  • Get Image Grid
  • Get Interval
  • Get Options
  • Get Table
  • Get Table Information
  • Get Tree Nodes
  • Get Value
  • Handle Open File Dialog
  • Handle Save File Dialog
  • Launch and Attach Window
  • Launch or Attach Window
  • Map Image Grid
  • Maximize or Minimize Window
  • Offset Value
  • Screenshot Window
  • Select Row
  • Select Tab
  • Set Execution Throttling
  • Set Grid Value
  • Set Value
  • Update Window
  • Verify Enabled
  • Verify If Visible
  • Wait and Close Security Window
  • Wait Busy Window
  • Wait Control
  • Wait for Control to Enable
  • Wait for Window to Appear
  • Watch and Close Window