- Release Notes
- Getting Started
- Setup and Configuration
- Automation Projects
- Dependencies
- Types of Workflows
- File Comparison
- Automation Best Practices
- Source Control Integration
- Debugging
- The Diagnostic Tool
- Workflow Analyzer
- About Workflow Analyzer
- ST-NMG-001 - Variables Naming Convention
- ST-NMG-002 - Arguments Naming Convention
- ST-NMG-004 - Display Name Duplication
- ST-NMG-005 - Variable Overrides Variable
- ST-NMG-006 - Variable Overrides Argument
- ST-NMG-008 - Variable Length Exceeded
- ST-NMG-009 - Prefix Datatable Variables
- ST-NMG-011 - Prefix Datatable Arguments
- ST-NMG-012 - Argument Default Values
- ST-NMG-016 - Argument Length Exceeded
- ST-DBP-002 - High Arguments Count
- ST-DBP-003 - Empty Catch Block
- ST-DBP-007 - Multiple Flowchart Layers
- ST-DBP-020 - Undefined Output Properties
- ST-DBP-023 - Empty Workflow
- ST-DBP-024 - Persistence Activity Check
- ST-DBP-025 - Variables Serialization Prerequisite
- ST-DBP-026 - Delay Activity Usage
- ST-DBP-027 - Persistence Best Practice
- ST-DBP-028 - Arguments Serialization Prerequisite
- Variables
- Arguments
- Imported Namespaces
- Recording
- UI Elements
- Control Flow
- About Control Flow
- Control Flow Activities
- Selectors
- Object Repository
- Data Scraping
- Image and Text Automation
- Automating Citrix Technologies
- RDP Automation
- SAP Automation
- VMware Horizon Automation
- Logging
- The ScaleCoordinates Migration Tool
- The ScreenScrapeJavaSupport Tool
- The WebDriver Protocol
- StudioPro
- Extensions
- Troubleshooting
Control Flow Activities
The Assign activity is an important activity that is going to be used quite often, as it enables you to assign a value to a variable.
You can use an Assign activity to increment the value of a variable in a loop (see the example in the The Do While Activity chapter), sum up the value of two or more variables and assign the result to another variable (see the example in the Generic Value Variables), assign values to an array (see Array Variables) and so on.
By default, this activity is also included in the Favorites group. To remove it, right-click it and select Remove.
The Delay activity enables you to pause the automation for a custom period of time (in the hh:mm:ss format). This activity proves itself quite useful in projects that require good timing, such as waiting for a specific application to start or waiting for some information to be processed so that you can use it in another activity.
To exemplify how you can best use the Delay activity, let's create an automation that writes two messages to the Output panel, with a delay of 20 seconds between them.
The Do While activity enables you to execute a specified part of your automation while a condition is met. When the specified condition is no longer met, the project exits the loop.
This type of activity can be useful to step through all the elements of an array, or execute a particular activity multiple times. You can increment counters to browse through array indices or step through a list of items.
To exemplify how to use a Do While activity, let’s create an automation that increments an integer variable from 0 to 10, and displays a message every time it is incremented.
The If activity contains a statement and two conditions. The first condition (the activity in the Then section) is executed if the statement is true, while the second one (the activity in the Else section) is executed if the statement is false.
If activities can be useful to make decisions based on the value of variables.
To exemplify how you can use the If activity, let’s create an automation that asks the user for two numbers, checks to see if one is divisible by the other, and depending on the result, displays a different message in the Output panel.
The Switch activity enables you to select one choice out of multiple, based on the value of a specified expression.
By default, the Switch activity uses the integer argument, but you can change it from the Properties panel, from the TypeArgument list.
The Switch activity can be useful to categorize data according to a custom number of cases. For example, you can use it to store data into multiple spreadsheets or sort through names of employees.
To exemplify how to use the Switch activity, we are going to create an automation that asks the user for a number, checks if is odd or even, and depending on that, a different message is written to the Output panel.
Since all odd numbers divided by two have a remainder equal to 1, this project needs only two cases (0 and 1) , yet keep in mind that this activity supports multiple cases.
The While activity enables you to execute a specific process repeatedly, while a specific condition is met. The main difference between this and the Do While activity is that, in the first one, the condition is evaluated before the body of the loop is executed.
This type of activity can be useful to step through all the elements of an array, or execute a particular activity multiple times. You can increment counters to browse through array indices or step through a list of items.
To exemplify how to use a While activity, let’s create an automation that increments an integer variable from 10 to 100, and writes all the numbers to a Microsoft Word document.
The For Each activity enables you to step through arrays, lists, data tables or other types of collections, so that you can iterate through the data and process each piece of information individually.
To exemplify how to use a For Each activity, let’s create an automation that goes through each element of an array of integers and writes the length of the array and each element to the Output panel.
The Break activity enables you to stop the loop at a chosen point, and then continues with the next activity.
To exemplify how to use the Break activity we are going to build upon the project created for The For Each Activity. This new project writes only the first iteration of the loop and a few elements of the array to the Output panel.
- The Assign Activity
- The Delay Activity
- Example of Using the Delay Activity
- The Do While Activity
- Example of Using a Do While Activity
- The If Activity
- Example of Using an If Activity
- The Switch Activity
- Example of Using a Switch Activity
- The While Activity
- Example of Using a While Activity
- The For Each Activity
- Example of Using a For Each Activity
- The Break Activity
- Example of Using a Break Activity