Get Bounds
Verb: getBounds
Gets the bounds of a control.
Syntax
getBounds --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)] (Numeric)=top (Numeric)=bottom (Numeric)=left (Numeric)=right (Numeric)=width (Numeric)=height
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--selector | Selector | Required | ControlSelectors | Type of selector used to identify user interface controls. The following options are available:
It is possible to use the IBM RPA Studio's recorder to map the controls and obtain the necessary information for the “Selector” parameters, in addition to inserting commands in the script with automatic filling of these parameters. The recorder is available in the upper toolbar on the platform. |
--id | Id | Only whenSelector is Id, IdAndName | Text | Id of the control which the bounds should be obtained. |
--name | Name | Only whenSelector is Name, NameAndValue, IdAndName, TypeAndName | Text | Name of the control from which the bounds should be obtained. |
--innertext | Text | Only whenSelector is InnerTextAndTag | Text | Inner text of the control from which the bounds should be obtained. |
--tagname | Element Type | Only whenSelector is InnerTextAndTag | Text | Type of the element of which the bounds should be obtained. |
--xpath | XPath | Only whenSelector is XPath | Text | XPath that leads to the control of which the bounds should be obtained. |
--classname | Class | Only whenSelector is ClassAndValue, ClassName | Text | Class of the control of which the bounds should be obtained. |
--elementvalue | Element Value | Only whenSelector is ClassAndValue, NameAndValue | Text | Current value of the element of which the bounds should be obtained. |
--controltype | Type | Only whenSelector is TypeAndIndex, TypeAndName | ControlTypes | Type of the element of which the bounds should be obtained. |
--index | Index | Only whenSelector is TypeAndIndex | Number | Index of the control of which the bounds should be 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, makes it possible to find an element within a table by column or row. |
--searchbycolumn | Search by Column | Optional | Boolean | When enabled, fetches the element through the column, not by 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.
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. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
top | Top Bounds | Number | Returns the top bounds of the control. |
bottom | Bottom bounds | Number | Returns the lower bounds of the control. |
left | Left bounds | Number | Returns the left bounds of the control |
right | Right bounds | Number | Returns the right bounds of the control. |
width | Width | Number | Returns the width of the control. |
height | Height | Number | Returns the height of the control. |
Example
The Launch and Attach Window command starts a Notepad window. The Get Bounds command identifies this window by XPath and obtains its limits, returning these values in the declared variables. The command Log Message shows the values obtained from the IBM RPA Studio console.
defVar --name topLimit --type Numeric
defVar --name bottomLimit --type Numeric
defVar --name leftLimit --type Numeric
defVar --name rightLimit --type Numeric
defVar --name width --type Numeric
defVar --name height --type Numeric
launchWindow --executablepath "notepad.exe"
getBounds --selector "XPath" --xpath "/root/titlebar[1]" --timeout 00:00:05 bottomLimit=bottom height=height leftLimit=left rightLimit=right topLimit=top width=width
logMessage --message "\r\nHeight: ${height}\r\nWidth: ${width}\r\nRight Limit: ${rightLimit}\r\nLeft Limit: ${leftLimit}\r\nBottom Limit: ${bottomLimit}\r\nTop Limit: ${topLimit}" --type "Info"
// Results may vary depending on the window size when opened, its position in the screen, among other factors
Remarks
It is possible to use the IBM RPA Studio's recorder to obtain the following information: