Loop Actions

Description: In computer programming, a loop is a fundamental yet powerful technique that is commonly used in writing programs. A loop is a sequence or "block" of instructions that is continually repeated a specified number of times or until a certain condition is reached. It allows a very simple operation to produce a significantly greater result simply by repetition. For example, websites that produce extremely complex output, such as a message board, are really only executing a single task many times. In this case, during each iteration, the program reads the latest data and outputs the content onto the message board.

Similar to the concept of loops in programming, the Loop activities in allows repeated execution of a group of steps that are placed inside the 'Loop – End Loop' block. The number of the times these steps are executed will depend on the type of Loop activity selected. For instance, the Loop processes activity can be used to check if a certain process is running by looping through all available processes in the system. The Loop files activity can loop through and rename all files contained in a folder or delete files that are older than a specific date. The Loop dataset activity can loop through and perform operations on each line of data retrieved from an Excel document or SQL database.

The Loop - End Loop block might also contain within it another Loop - End Loop block (also known as a nested loop) or may contain one or more If-End If blocks to control the overall flow of a task. For example, a certain process is performed inside a loop and then some condition is checked. If it hasn't, the task returns to the beginning of the loop and repeats the sequence until the condition has been reached, at which point, task flow branches outside the loop to complete the remainder of steps. A loop is therefore one of the basic ways in which you can implement complex flows of execution, with multiple processes encapsulated in a few lines of code.

Available Activities

The list of activities for this action are arranged below in alphabetical order. For more information about a specific activity, click the associated link.

Activity

Description

Loop - Array

Loops through an array, populating the specified variable with the current element.

Loop - Break

Breaks out of a Loop or If statement.

Loop - Dataset

Loops through the rows of the dataset specified. With each successive loop a series of steps are executed and the current row of the dataset is incremented. The loop ends when it reaches the end of the dataset or when a Break is encountered.

Loop - End loop

Marks the end of a block of steps that is to be looped by any of the Loop actions.

Loop - Expression

Loops while or until the expression specified is true. With each successive loop, the expression is re-evaluated. The loop ends after the condition is met or when a Break is encountered.

Loop - File contents

Loops through the contents of the specified text file and populates a variable with the current string of delimited text. The loop ends at the end of the file or if a Break step is encountered.

Loop - Files

Loops through the files contained in a folder and populates a variable with the current file name. With each successive loop, the next file name is retrieved. The loop ends after all the file names have been retrieved or when a Break is encountered. This action accepts wildcards (* and ?).

Loop - List

Loops through items in a list (comma, carriage return, or other delimited text). With each successive loop a block of steps is executed and the current index variable is updated with the next item in the list. The loop ends when at the end of the list or when a Break is encountered.

Loop - List control

Loops through the items of a list box or list view and populates a variable with the current item text. With each successive loop, the next item is retrieved. The loop ends after all the elements have been browsed or when a Break is encountered.

Loop - Processes

Loops through the file names of the processes (applications) that are currently running on the system and populates a variable with the file name of the current process. With each successive loop, the next process file name is retrieved. Optionally, a dataset can be populated with extended process information. The loop ends after all the process file names have been retrieved or when a Break is encountered.

Loop - Range

Loops through the range of numbers specified. With each successive loop, a block of steps are executed. An index variable can optionally update the current loop count. The loop ends after the counter has reached the number specified or when a Break is encountered.

Loop - Tree control

Loops through the items of a tree view. The variable specified is updated with the current item text. With each successive loop, the next item is retrieved. The loop ends after all the elements have been browsed or when a Break is encountered.

Loop - Windows

Loops through all of the Windows that are currently open on the system. The variable specified is updated with the current window title. With each successive loop, the next window title is retrieved. The loop ends after the window title of all the open windows have been retrieved or when a Break is encountered.