This online help file is for the Advanced Workflow Engine v8. For other versions, please refer to http://help.globalscape.com/help/index.html. (If the Index and Contents are hidden, click Show Contents pane in the top left corner of this topic.) |
Environment Variables |
||
See Also |
Create Array, Create Object, Create Variable, Define Type, ReDim Array, Set Variable, Services, Connect to Network, Exchange, Run, Execute DLL Function |
Windows Environment variables are strings that contain information about various system components as well as certain basic system information (i.e. drive, path and filename). They control the behavior of the system, various programs and the currently logged on user. Environment variables are very convenient in scripts where certain standard directories and parameters need to be referenced but where the actual locations or names can vary from computer to computer.
AWE encompasses a number of activities aimed to automate the creation, manipulation and management of environment variables in a Windows-based operating system without the use of scripts or the command line. Activities include the ability to get, set, list and delete environment variables as well as append data to an existing environment variable.
|
In the Activity to perform box, select an activity, then configure the properties for that activity. The available properties depend on the activity selected.
To set properties
In the Available Actions pane, open the System folder and double-click the action or drag it into the Steps pane.
On the Properties tab, select an Activity to perform.
Specify the properties that appear, depending on the activity selected.
To set the Description tab properties, refer to Description Tab Options.
To set the Error Causes and On Error tab properties, refer to Step Error Handling.
When finished, click OK to save settings and close the properties dialog box.
Available Activities
The following table briefly describes the available activities for this action as specified in the Activity to perform box.
Activity |
Description |
Declaration |
Examples |
Append |
Appends text to a system or user-level environment variable. Optionally, this action can populate a variable with the resulting value. |
<AMAPPENDENVIRONMENT NAME="text" TYPE="text(options)" VALUE="text" RESULTVARIABLE="text" /> |
This example creates a variable named "theVar". Next, it appends text "\subtemp" to environment variable "TEMP" of type "user". Finally, a message box displays the value of the "%theVar%" (which is the value of the TEMP environment variable with the newly appended text). <AMVARIABLE NAME="theVar"></AMVARIABLE> <AMENVVARS ACTIVITY="append" TYPE="USER" NAME="TEMP" VALUE="\subtemp" RESULTVARIABLE="theVar" /> <AMSHOWDIALOG>%theVar%</AMSHOWDIALOG> |
Delete |
Removes a system or user-level environment variable. |
<AMREMOVEENVIRONMENT NAME="text" TYPE="text(options)" /> |
This example demonstrates a number of activities related to environment variables. An Environment Variable - Set activity creates a new environment variable of type "User" named "AMTemp" along with the value of "Training". A Create Variable action creates a variable named "EnvironmentVarValue". An Environment Variable - Get activity populates the variable with the value of the newly created environment variable. Thereafter, a Message Box 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="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" /> |
Get |
Retrieves the value of a system-level or user-level environment variable and places it into a variable. |
<AMGETENVIRONMENT NAME="text" TYPE=text(options)" RESULTVARIABLE="text" /> |
This example demonstrates a number of activities related to environment variables. An Environment Variable - Set activity creates a new environment variable of type "User" named "AMTemp" along with the value of "Training". A Create Variable action creates a variable named "EnvironmentVarValue". An Environment Variable - Get activity populates the variable with the value of the newly created environment variable. Thereafter, a Message Box 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="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" /> |
List |
Populates a dataset with the names and values of a specified type of environment variable. |
<AMLISTENVIRONMENTVARIABLES RESULTDATASET="Text" TYPE="Text" /> |
This example 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> |
Set |
Sets the value of a system-level or user-level environment variable, and optionally creates the variable if it does not exist. |
<AMSETENVIRONMENT NAME="text" TYPE="text(options)" VALUE="text" /> |
This example demonstrates a number of activities related to environment variables. An Environment Variable - Set activity creates a new environment variable of type "User" named "AMTemp" along with the value of "Training". A Create Variable action creates a variable named "EnvironmentVarValue". An Environment Variable - Get activity populates the variable with the value of the newly created environment variable. Thereafter, a Message Box 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="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" /> |
Environment Variable Properties
Property |
Type |
Required |
Default |
Markup |
Description |
Variable Name |
Text |
Yes |
(Empty) |
NAME="TEMP" |
The name of the environment variable to which the text will be appended. |
Variable Scope |
Text |
Yes |
User |
TYPE="USER" |
The scope of the environment variable. The available options are:
|
Text to append |
Text |
Yes |
(Empty) |
VALUE="new text" |
The text to be appended to the value of the environment variable. |
Populate variable with value |
Text |
No |
(Empty) |
RESULTVARIABLE="VarName" |
The name of an already created variable in which to populate with the resulting value. |
Create and populate dataset |
Text |
Yes |
(Empty) |
RESULTDATASET="datasetname" |
The name of the 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. |
New value |
Text |
Yes |
VALUE="C:\Documents and Settings\Users\Temp" |
The new value of the environment variable. |
|
Overwrite environment variable value |
Yes/No |
No |
Yes |
OVERWRITE="NO" |
If set to YES, the new value will overwrite the current value of an existing environment variable. |
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
The Error Causes tab is part of AWE'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
The On Error tab is part of AWE'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
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. |
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.