Get Image Grid
Verb: getGrid
❕ Important: Starting from version 23.0.6, this command is deprecated. For more information, see Deprecated.
Gets a control grid represented by an image.
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
getGrid [--hascolumnheaders(Boolean)] [--hasrowheaders(Boolean)] [--hasbandrows(Boolean)] [--forcerefresh(Boolean)] --selector(ControlSelectors) --id(String) --name(String) --innertext(String) --tagname(String) --xpath(String) --classname(String) --elementvalue(String) --controltype(Nullable<ControlTypes>) --index(Numeric) --control(Control) [--usetable(Boolean)] [--searchbycolumn(Boolean)] --searchcolumn(String) --searchvalue(String) --returncolumn(String) --row(Numeric) [--timeout(TimeSpan)] (ImageGrid)=value (Numeric)=rows (Numeric)=columns
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --hascolumnheaders | Column Headers | Optional | Boolean | When enabled, the header will be considered in the grid columns. |
| --hasrowheaders | Row Headers | Optional | Boolean | When enabled, the header in the grid rows will be considered. |
| --hasbandrows | Alternating Lines | Optional | Boolean | This must be enabled when there are alternating background colors of the rows. |
| --forcerefresh | Update Screen Cache | Optional | Boolean | When enabled, performs a new reading of the screen before executing the command, to identify new elements and update the screen cache.
This identification is necessary for the command to work, in case there is any change on the screen. |
| --selector | Selector | Required | ControlSelectors | Type of selector used to identify user interface controls. The following options are available:
|
| --id | Id | Only whenSelector is Id, IdAndName | Text | Id of the Control from which the grid is obtained. |
| --name | Name | Only whenSelector is Name, NameAndValue, IdAndName, TypeAndName | Text | Name of the control from which the grid is obtained. |
| --innertext | Text | Only whenSelector is InnerTextAndTag | Text | Inner text of the control from which the grid obtained. |
| --tagname | Element Type | Only whenSelector is InnerTextAndTag | Text | Type of the element from which the grid is obtained. |
| --xpath | XPath | Only whenSelector is XPath | Text | XPath leading to the control from which the grid is obtained. |
| --classname | Class | Only whenSelector is ClassAndValue, ClassName | Text | Class of the control from which the grid is obtained. |
| --elementvalue | Element Value | Only whenSelector is ClassAndValue, NameAndValue | Text | Value of the element from which the grid is obtained. |
| --controltype | Type | Only whenSelector is TypeAndIndex, TypeAndName | ControlTypes | Type of the control from which the grid is obtained.
The available options are: |
| --index | Index | Only whenSelector is TypeAndIndex | Number | Index of the control from which the grid is obtained. |
| --control | Control | Only whenSelector is Instance | Control | Control instance.
This variable is obtained using the command Search Control. |
| --usetable | Element in Table | Optional | Boolean | When enabled, searches for an element within a table by column or row. |
| --searchbycolumn | Search by Column | Optional | Boolean | When enabled, searches for an element in the table by column, instead of row. |
| --searchcolumn | Column | Only whenElement in Table is True | Text | Name or number of the column from which to get the element. |
| --searchvalue | Value | Only whenSearch by Column is True | Text | Value used to find the element in the table. |
| --returncolumn | Return Column | Only whenSearch by Column is True | Text | Column that contains the control. |
| --row | Row | Only whenSearch by Column is False | Number | Table row to find the element. |
| --timeout | Timeout | Optional | Time Span, Number, Text | Command execution timeout.
In case no value is defined for the timeout parameter, the execution uses the context timeout defined by the Set Timeout command. If that command is not used on the script, the default timeout is 5 seconds. |
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| value | Grid | Image Grid | Returns the obtained grid. |
| rows | Rows | Number | Returns the number of rows in the obtained grid. |
| columns | Columns | Number | Returns the number of columns in the obtained grid. |
Example
The Launch or Attach Window command opens an MS Paint window , and the Get Image Grid command obtains an image grid from the color selection grid. The number of rows and columns of the gotten grid is displayed in the IBM RPA Studio console.
defVar --name mappedGrid --type ImageGrid
defVar --name rows --type Numeric
defVar --name columns --type Numeric
launchOrAttach --executablepath "mspaint.exe" --useregex --regexPattern "Untitled - Paint" --regexOptions "0"
getGrid --selector "XPath" --xpath "/root/pane[3]/pane[1]/pane[1]/pane[1]/pane[1]/pane[1]/custom[1]/custom[1]/toolbar[1]/group[1]" columns=columns rows=rows mappedGrid=value
logMessage --message "Rows: ${rows}\r\n Columns: ${columns}" --type "Info"
// Returns the number of rows and columns of the gotten grid.
Remarks
It is possible to use the IBM RPA Studio's recorder to obtain the following information:
This command gets the image and maps the grid automatically. It does not allow you to manually map a control grid.