Environment Variables - List

Declaration

<AMLISTENVIRONMENTVARIABLES RESULTDATASET="Text" TYPE="Text" />

See Also

Environment Variables - Append | Environment Variables - Delete | Environment Variables - Get | Environment Variables - List | Environment Variables - Set

Description

Populates a dataset with the names and values of a specified type of environment variable.

IMPORTANT: Basic knowledge about Windows system and user level environment variables and their functionality are required in order to properly use these activities.

Practical Usage

Used to create an AutoMate dataset that lists the names and values of a specified type of environment variable. The data can then be extracted from the dataset using other actions such as Loop Dataset or Dataset to Cells.

Parameters

General Properties

Property

Type

Req'd

Default

Markup

Description

Environment Variable Scope

Text

Yes

User

TYPE="USER"

The scope of the environment variables to retrieve. The available options are:

  • User (Default)

  • Machine

  • Process

Create and Populate Dataset

Text

Yes

(Empty)

RESULTDATASET="datasetname"

The name of the AutoMate dataset that should be created and populated with the names and values of the environment variables. More on the dataset fields that this activity creates can be found below under Additional Notes below.

Description Properties

The Description tab allows you to customize the text description of any step when it appears in the Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab is part of AutoMate's Error Handling functionality which allows you to select / omit specific errors that will cause a particular step to fail.

More about error causes properties

On Error Properties

The On Error tab is part of AutoMate's Error Handling functionality which allows you to determine what the task should do if a particular step encounters an error.

More about on error properties

Additional Notes

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the dataset name assigned was theDataset).

Name

Type

Return Value

theDataset.VarName

Text

Returns the name of the environment variable.

theDataset.VarValue

Text

Returns the value of the environment variable.

Variables and Expressions

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

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: This sample task uses an Environment Variables - List activity (step 1) to retrieve all "user" level environment variables and populates a dataset with the results. A Loop Dataset action loops through the dataset. A Message Box activity displays each environment variable retrieved during each loop process.

 

<AMENVVARS ACTIVITY="list" TYPE="USER" RESULTDATASET="theDataset" />

<AMLOOP TYPE="DATASET" DATASET="theDataset">

     <AMSHOWDIALOG WINDOWTITLE="ENVIRONMENT VARIABLE NAME/VALUE">Environment Variable Name:

%theDataset.VarName%

Environment Variable Value:

%theDataset.VarValue%</AMSHOWDIALOG>

</AMLOOP>

 

↑ Top of Page