Wait for Control to Enable
Verb: waitEnabled
It awaits a control to be enabled, using the Timeout parameter as a maximum wait time for execution. At the end, it returns whether it is enabled or not.
Controls are, on Windows, elements that allow the user to interact with an application. Controls may be buttons, data entry fields, menus and various other elements.
Syntax
waitEnabled --timeout(TimeSpan) --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) (Boolean)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--timeout | Timeout | Required | Time Span, Number, Text | Maximum wait time until the control is enabled.
If no value is defined in the parameter of type timeout, the execution uses the time defined by the Set Timeout command. If the script does not use this command, the default time is 5 seconds. |
--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 | User interface control id. |
--name | Name | Only whenSelector is Name, NameAndValue, IdAndName, TypeAndName | Text | Name of the user interface control. |
--innertext | Inner Text | Only whenSelector is InnerTextAndTag | Text | Internal text of the user interface control. |
--tagname | Tag Name | Only whenSelector is InnerTextAndTag | Text | Type of the element or tag. |
--xpath | XPath | Only whenSelector is XPath | Text | XPath of the user interface control. |
--classname | Class | Only whenSelector is ClassAndValue, ClassName | Text | User interface control class. |
--elementvalue | Element Value | Only whenSelector is ClassAndValue, NameAndValue | Text | Current value of the user interface control. |
--controltype | Type | Only whenSelector is TypeAndIndex, TypeAndName | ControlTypes | Type of UI 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, searches for an element within the table. |
--searchbycolumn | Search by Column | Optional | Boolean | When enabled, searches for the element by the columns, not by rows. |
--searchcolumn | Column | Only whenElement in Table is True | Text | Name or number of the column to get the element from. |
--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. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Enabled | Boolean | Returns "True", if the field is enabled, or "False", if not. |
Example
This example opens MS Paint, waits until the control is enabled, using the Timeout parameter as the timeout value, and returns whether it is enabled or not.
defVar --name paintWindow --type Window
defVar --name waitEnabled --type Boolean
launchWindow --executablepath "C:\\Windows\\system32\\mspaint.exe" paintWindow=value
// Check if parameter is enabled
waitEnabled --timeout 00:00:40 --selector "Name" --name View waitEnabled=value
logMessage --message "View parameter is enabled in the current execution context: ${waitEnabled}" --type "Info"
closeWindow --window ${paintWindow}
// The return varies according to the current execution context. In the case of this example: True.