Best Practices for Managing Screen Element Recognition

Automation Studio allows you to enable and disable recognition of a screen element.

The recommended best practice is to enable recognition of each screen element for only as long as it is needed, and to disable recognition when the screen element is not needed.

Why Disable Recognition of a Screen Element?

Reasons for disabling recognition of a screen element when not in use include:

  • To reduce load on system resources.

  • To prevent a situation in which two solutions monitor the same screen element as this may cause unexpected behavior.

    This situation can occur in the case in which a project was built by importing a second project (as described in Recommended Solution Architecture), and both projects reference the same screen element.

How to Disable and Enable Recognition of Screen Elements

Below are recommendations on how to disable and enable recognition of a screen element. These recommendations are demonstrated in the example below the table.

REquirement

Recommended Implementation

Disable recognition of screen elements when the solution is loaded initially

Create an Event Handler as follows:

  • Trigger the event handler using the Solution Loaded event from the Administration built-in service.

  • Disable each screen element used in the project using its Disable Recognition method.

    If multiple screen elements share the same ancestor element in the hierarchy, it is sufficient to disable recognition of that ancestor screen element: recognition of all its descendent screen elements will be disabled.

Enable recognition of selected screen elements when needed

When a workflow that interacts with a screen element is started, recognition of that screen element must be enabled.

The recommended best practice is to use an event handler to enable recognition of that screen element, as follows:

  • Trigger the event handler using the workflow's Started event.

  • Enable recognition of each screen element used in the workflow using its Enable Recognition method.

    Remember that enabling recognition of a screen element will not have any effect if recognition of an ancestor screen element in the hierarchy is still disabled.

Alternatively, you can enable recognition of the screen element within a step of the workflow itself.

Disable recognition of screen elements after use

When a workflow that interacts with a screen element ends, recognition of that screen element should be disabled.

The recommended best practice is to use an event handler to disable recognition of that screen element, as follows:

  • Trigger the event handler using the workflow's Ended event.

  • Disable recognition of each screen element used by the workflow using its Disable Recognition method.

    If multiple screen elements share the same ancestor element in the hierarchy, it is sufficient to disable recognition of that ancestor screen element: recognition of all its descendent screen elements will be disabled.

Alternatively, you can disable recognition of the screen element within a step at the end of the workflow itself.