|
Environment Variables - Get |
Declaration
<AMENVVARS NAME="text" RESULTVARIABLE="text" TYPE="text (options)" />
Description
Retrieves the value of a machine, user or process level environment variable and places it into an Automate variable.
Practical Usage
Used to populate an Automate variable with the current value of a particular environment variable so the data can be called upon in subsequent task steps.
Parameters
Environment Variable
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Variable scope | Text | Yes | User |
|
The
scope or level of the environment variable to retrieve. The available options are:
|
Environment variable | Text | Yes | (Empty) | NAME="TEMP" | The name of the environment variable to retrieve. |
Populate variable with value | Text | No | (Empty) | RESULTVARIABLE="VarName" | The name of an already created Automate variable in which to populate with the value of the retrieved environment variable. |
Example
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
Description
This sample task demonstrates a number of activities related to environment variables. An Environment Variables - Set activity creates a new environment variable of type "User" named "AMTemp" along with the value of "Automate Training". A Variable - Create activity creates an Automate variable named "EnvironmentVarValue". An Environment Variables - Get activity populates the Automate variable with the value of the newly created environment variable. Thereafter, a Dialog - Message activity displays the value of the created environment variable. The final step deletes the environment variable with the use of the Environment Variables - Delete activity.
<AMENVVARS ACTIVITY="set" TYPE="USER" NAME="AMTemp" VALUE="Automate Training" />
<AMVARIABLE NAME="EnvironmentVarValue"></AMVARIABLE>
<AMENVVARS TYPE="USER" NAME="AMTemp" RESULTVARIABLE="EnvironmentVarValue" />
<AMSHOWDIALOG>The value of environment variable 'AMTemp' is '%EnvironmentVarValue%'.</AMSHOWDIALOG>
<AMENVVARS ACTIVITY="delete" TYPE="USER" NAME="AMTemp" />