Screen Element Support
(Available from version 7.1 onwards.)
The Screen Element Support built-in service includes functions for managing screen elements.
Functions
Allows a specified screen element to be recognized during run-time. By default, all screen elements are set to be recognized when the project is loaded, but recognition can be disabled per screen element using the Disable Recognition function.
Enabling recognition of one element in a screen element hierarchy does not enable recognition of elements lower in the hierarchy if their recognition was previously disabled overtly using the Disable Recognition function. (If screen elements lower in the hierarchy stopped being recognized because a higher element was disabled, enabling that element will allow those lower elements to be recognized again.)
If recognition of the top screen element in a hierarchy (i.e. the Process element) was disabled, its recognition cannot be enabled again.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
internal ID | Text |
The internal ID of the screen element, as indicated in the Edit Screen Element window. See the example. |
project name | Text |
The name of the project in which the screen element was captured, as displayed in Automation Studio, without any path or extension. See Referenced Project Screen Element Recognition below. |
Returns
Nothing
Example
A project includes a screen element that represents the editing area of Windows Notepad. The internal ID of the screen element is se2, as shown.
The project is name Recognit.
This workflow enables recognition of the screen element.
This workflow disables recognition of the screen element.
When recognition of the screen element is enabled, the Debug panel indicates that the screen element exists, and the text in the Notepad is shown.
When recognition of the screen element is disabled, the Debug panel indicates that the screen element does not exist, and the text in the Notepad edit area is not shown. Because recognition is disabled, the automation solution is unable to detect the Notepad edit area.
Prevents a specified screen element from being recognized during run-time. By default, all screen elements are set to be recognized, but recognition can be disabled per screen element.
Disabling recognition of screen elements when they are not needed can improve performance.
Disabling recognition is also useful when you have more than one solution loaded by the same client but want only one solution to interact with common screen elements at any time.
Recognition can be enabled per screen element using Enable Recognition.
If you disable recognition of one element in a screen element hierarchy, no elements below it will be recognized. If recognition of that element is then enabled, all elements below it will be again be recognized.
To enable/disable recognition of an entire screen element branch, enable/disable the highest relevant element in the branch. Disabling screen element se3 in the example below will disable recognition of that element and all elements below it in the hierarchy.
Note that if you disable the top screen element in a hierarchy (i.e. the Process element), it cannot be enabled again.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
internal ID | Text |
The internal ID of the screen element, as indicated in the Edit Screen Element window. See the example. |
project name | Text | The name of the project in which the screen element was captured, as displayed in Automation Studio, without any path or extension. See Referenced Project Screen Element Recognition below. |
Returns
Nothing
Example
See the example shown for Enable Recognition.
Referenced Project Screen Element Recognition
Both the Enable Recognition and Disable Recognition functions include a parameter Project Name.
To enable or disable recognition of a screen element located within the current project, simply enter the name of the current project.
The Project Name parameter is provided so that you can control recognition of screen elements located within other projects referenced by the current project. In such a case, set the Project Name parameter to the name of the referenced project, and the Internal ID parameter to the internal ID assigned to the screen element in the referenced project.
An example is provided below. However, the recommended best practice is to enable and disable recognition of screen elements from within the referenced project itself. That way, if the referenced project is reused by multiple projects, you do not have to remember to manage screen element recognition in each project. For an example of this approach, see Best Practices for Managing Screen Element Recognition.
Example
The project WriteToNotepad includes a single workflow, also called WriteToNotepad , that writes the text SampleText into an open Notepad window.
The internal ID of the Notepad screen element is se1.
The project shown above, WriteToNotepad, was imported for use by another project called CentralProject, and is listed under Imported Automation Libraries, together with its workflow.
The CentralProject project has a single workflow, Workflow 1, that invokes (starts) the referenced workflow WriteToNotepad using its Start method.
To enable recognition of the Notepad from this workflow, an additional step is added. Note that the Project Name parameter is set to the name of the referenced project.
Similarly, another step can be added to disable recognition of the Notepad window after the workflow ends.
The transition into the last step is delayed until the WriteToNotepad workflow's Ended event is fired, to ensure that the screen element is not disabled before that workflow completes.