Loop Processes Action
TYPE="PROCESSES" RESULTVARIABLE="text" [variablename]"
KEEPPATHS="yes/no" INCLUDE="text" EXCLUDE="text"
Loops through the filenames of the processes (applications) that are currently running on the system. The variable specified is updated with the process filename. With each successive loop, the next process filename is retrieved. The loop ends after all the process filenames have been retrieved or when a Break is encountered.
To perform an action on every process (application) open on the system.
Specifies an already created variable name that should be populated with the next process name on each successive loop. The variable must be created in an earlier step using the Create Variable action.
Specifies that the folder path should be removed from the return value so that a filename only (the process name) is returned.
Specifies the name of a dataset to be created and populated with process data. In addition to the standard dataset fields, the dataset will contain the following:
ProcessName: The path and file name of the process's .exe file.
ProcessID: The unique ID of the process.
WindowTitle: The title of the process's main window.
WindowClass: The class of the process's main window. A window class is a set of attributes that the system uses as a template to create a window. Every window is a member of a window class. All window classes are process specific.
WindowHandlle: The handle of the process's main window. A window handle is a code that uniquely identifies the window.
Specifies the wildcard mask that should be included in the loop. For example, if *notepad.exe was specified, the loop would only include processes with the name notepad.exe, in other words, all open instances of Notepad regardless of the folder they were launched from or whether or not they were displayed. Standard wildcard characters * and ? are allowed.
Specifies the wildcard mask that should be excluded from the loop. For example, if *notepad.exe was specified, the loop would exclude all processes with the name notepad.exe. Standard wildcard characters * and ? are allowed.
Specifies whether a sort order should be applied to the values before the loop begins. For example, selecting "ascending" would return the process names in alphabetical order.
The available options are:
none: The results are left in their natural order and not sorted.
ascending: The results sorted in ascending alphabetical order.
descending: The results sorted in descending alphabetical order.
This action includes the Description tab for entering a custom step description.
More on setting custom step description
This action also includes the standard Error Causes and On Error failure handling options/tabs.
More on Error Handling Options
All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.
More on variables
More on expressions
More on the expression builder
NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.
<!-- Closes all Notepad processes -->
<AMLOOP TYPE="PROCESSES" RESULTVARIABLE="currentprocess" INCLUDE="*notepad.exe" RESULTDATASET="ProcessDataset">
<AMENDPROCESS PROCESS="%currentprocess%" />