Guarded Choice

The guarded choice step is used to set up a number of conditions, each associated with some actions. Whichever condition or guard is satisfied first, its associated actions or steps are executed. This is often used to ensure that an interface element, such as a button, is present before trying to move to and click it. To avoid waiting indefinitely, a timeout guard is added. In Kofax RPA you can use location and timeout guards to make sure the robot finds the required elements and works as designed.

In many cases Kofax RPA adds guards automatically when you insert a step, such as Click or Press steps. The following guards are available.

When seconds have passed
This is a timeout guard that waits a specified time before executing the next step in your robot.
Note A default 60-second guard is inserted in the following steps when they are added via the Recorder View: Click, Scroll Mouse, Enter Text, Extract Value, Extract Contents, Extract Image, Extract Text From Image, and Press Key.
Application Found
Application guard that makes sure the application is found via a specified finder. If it does not find the application, it waits until it appears. If it finds more than one application, it waits until there is only one application.
Application Not Found
Application guard that makes sure the application is not found via a specified finder.
Location Found
Location guard that makes sure the element is found via a specified finder.
Location guard properties
Location Not Found
Location guard that makes sure the element is not found via a specified finder.
Location Removed
Finds an element via a specified finder and waits until the element is removed before executing the next step.
Tree Stops Changing
A timeout guard that waits a specified time after the last application or web page tree change before executing a step. The timeout is specified in milliseconds.

A Finder must be specified for each of the following location guards.

Add Guards Manually

To manually add a guard to a Guarded Choice step, hover your mouse over the bottom line of the guard frame until you see a green plus sign and click the plus to add a guard. See the following example.


Add guard manually to the guarded choice step

Tips and Tricks

Open documents directly
You do not need to launch the application first and then open the document. Instead, just open the document and it will launch the associated program.
Watch out for accessibility detection
  • When opening applications: Opening Adobe Reader using the Desktop Automation Service shows the Accessibility Setup Assistance window. Usually this is a one time setup, but if you have desktops being spawned on demand, it may require your robot to handle it.
  • When opening files: When a PDF file is opened, the Adobe Reader asks if the screen reader should process the document.
After pasting text into a field, use a guard for the next step

A guard verifies that the contents of the text field match what you pasted for the next action. Otherwise, the full value may not yet be in the field if you press Enter right after the paste operation.

Note This tip does not apply to password fields.