Set Grid Value
Verb: setGridValue
Sets a value to a cell in a control grid, according to the defined mappings.
Controls are, in the context of Windows, elements that allow the user to interact with an application. Controls can be buttons, data entry fields, menus and various other elements.
Syntax
setGridValue --value(String) --grid(ImageGrid) --row(Numeric) --column(Numeric)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--value | Value | Required | Text | Value that should be set to the cell. |
--grid | Grid | Required | Image Grid | Grid containing the cell to which the value should be set. |
--row | Row | Required | Number | Cell row to which the value should be set. |
--column | Column | Required | Number | Column of the cell to which the value should be set. |
Example
The Wait for Window to Appear command waits for an open Excel window, the Focus Window command focuses on the window, the Map Image Grid command maps the Grid in the window and the Set Grid Value command assigns the values "Microsoft" and "Redmond" in the first two cells of the fifth row of the table.
defVar --name excelWindow --type Window
defVar --name excelTable --type ImageGrid
defVar --name excelRows --type Numeric
defVar --name excelColumns --type Numeric
// tableExcelCompanyCity.xlsx.
waitWindow --title "tableExcelCompanyCity.xlsx - Excel" --classname XLMAIN --processname EXCEL excelWindow=value
focusWindow --window ${excelWindow}
mapGrid --columnmappings "26-141;141-281;281-386;386-451;451-515;515-578;578-643;643-707;707-771;771-836;836-898;898-964;964-1028;" --selector "XPath" --xpath "/root/pane[1]/pane[1]/pane[1]/datagrid[1]" excelTable=value excelColumns=rows excelRows=columns
setGridValue --value Microsoft --grid ${excelTable} --row 5 --column 1
setGridValue --value Redmond --grid ${excelTable} --row 5 --column 2
// An Excel window is awaited and focused, a window is mapped inside that window and the values are assigned to it.
For this example to run successfully, it is necessary to download the Excel file and open it before execution.