Loop Processes Action

Description

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.

Declaration

<AMLOOP TYPE="PROCESSES" RESULTVARIABLE="text" [variablename]" KEEPPATHS="yes/no" INCLUDE="text" EXCLUDE="text" SORT="text[options] "RESULTDATASET="text">
  (block of steps to loop)
</AMLOOP>

Example

<!-- Closes all Notepad processes -->

<AMVARIABLE NAME="currentprocess"></AMVARIABLE>

<AMLOOP TYPE="PROCESSES" RESULTVARIABLE="currentprocess" INCLUDE="*notepad.exe" RESULTDATASET="ProcessDataset">

     <AMENDPROCESS PROCESS="%currentprocess%" />

</AMLOOP>

General Tab Parameters

Populate variable with process name: 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.

Text, Required
MARKUP: RESULTVARIABLE="varname"

Do not include path information: Specifies that the folder path should be removed from the return value so that a filename only (the process name) is returned.

Yes/No, Optional, Default: No
MARKUP: KEEPPATHS="yes"

Create and populate dataset with extended process information: 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 ID of the process

  • WindowTitle: the title of the process's main window

  • WindowClass: the class of the process's main window

  • WindowHandlle: the handle of the process's main window

Text, Optional
MARKUP: RESULTDATASET="DatasetName"

Advanced Tab Parameters

Include processes: 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.

Text, Optional, Default: {blank—include all)
MARKUP: INCLUDE="*notepad.exe"

Exclude processes: 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.

Text, Optional, Default: {blank—include all)
MARKUP: EXCLUDE="*notepad.exe"

Output List: 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.

  • Do not sort the list: The results are left in their natural order and not sorted.

  • Sort the list in ascending order: The results sorted in ascending alphabetical order.

  • Sort the list in descending order: The results sorted in descending alphabetical order.

Text [options], Optional, Default: "none"
MARKUP: SORT="ascending"