Control Screenshot
Verb: printControl
Available from: <Standard>
Takes a screenshot of a user interface control, using a selector to identify the desired control.
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
printControl [--rectangle(Rectangle)] --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)] (Image)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--rectangle | Area | Optional | Rectangle | Delimits an area on the screen to take the screenshot. |
--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 of which the screenshot should be obtained. |
--name | Name | Only whenSelector is Name, NameAndValue, IdAndName, TypeAndName | Text | Name of the user interface control of which the screenshot should be obtained. |
--innertext | Text | Only whenSelector is InnerTextAndTag | Text | Inner text of the user interface control of which the screenshot should be obtained. |
--tagname | Element Type | Only whenSelector is InnerTextAndTag | Text | Type of the element or tag of the control of which the screenshot should be obtained.. |
--xpath | XPath | Only whenSelector is XPath | Text | XPath of the user interface control of which the screenshot should be obtained.. |
--classname | Class | Only whenSelector is ClassAndValue, ClassName | Text | Class of the user interface control of which the screenshot should be obtained. |
--elementvalue | Element Value | Only whenSelector is ClassAndValue, NameAndValue | Text | Current value of the user interface control of which the screenshot should be obtained. |
--controltype | Type | Only whenSelector is TypeAndIndex, TypeAndName | ControlTypes | Type of user interface control. Options:
|
--index | Index | Only whenSelector is TypeAndIndex | Number | Index of the user interface control. |
--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, search for an element within the table. |
--searchbycolumn | Search by Column | Optional | Boolean | When enabled, search for the element by column, not by row. |
--searchcolumn | Column | Only whenElement in Table is True | Text | Name or number of the column from which the element is obtained. |
--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 from which the element is obtained. |
--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 | Image | Image | Screenshot image taken. |
Example
The Control Screenshot command takes a screenshot of the Notepad text box, using the text box Id to identify it. Then, the image is saved on the desktop.
defVar --name desktopPath --type String
defVar --name image --type Image
getSpecialFolder --folder "Desktop" desktopPath=value
// Opens a Notepad window.
launchWindow --executablepath "notepad.exe"
// Takes a screenshot of the text box.
printControl --selector "Id" --id 15 image=value
// Save the image obtained in the work area.
saveImage --image ${image} --directory "${desktopPath}" --file "Control image capture" --format "Png"
Remarks
It is possible to use the IBM RPA Studio's recorder to obtain the following information: