Global Variables and Procedures

When adTempus runs a script, the script has access to several global properties, collections, and functions.

For WSH scripts (VBScript, JScript, etc.), these members are globally defined. For example, a VBScript script refers to the JobVariables collectionas follows:

JobVariables("MyVariable")="Some Value"

For .NET scripts (VB.NET, C#), these members belong to the globally-available "adTempus" object. For example, a VB.NET script refers to the Result property as follows:

adTempus.JobVariables("MyVariable")="Some Value"

Properties

Result Property

The Result property is a Variant property used to return a result to adTempus. The values that are valid will depend on the circumstances; in places where adTempus expects a result from a script, the documentation will indicate the value that should be returned. See, for example, the Script Execution task.

Checkpoint Property

The Checkpoint property is a String property that can be used to get or set the current checkpoint for the job. This is only meaningful for a script being run by a Script Execution task.

Collections

JobVariables Collection

The JobVariables collection contains the job variables for a job. Modifying the values in this collection in one step will affect all subsequent steps.

Note: Earlier versions of adTempus used separate "Environment" and "Parameters" collections. The JobVariables collection replaces both. For backward compatibility the "Environment" and "Parameters" members still exist, but they both point to the JobVariables collection.

The JobVariables collection has the following properties and methods:

Item

Gets or sets an environment variable. For example:

path=JobVariables.Item("path")
path=JobVariables("path")

JobVariables.Item("somekey")="somevalue"
JobVariables("somekey")="somevalue"

 

for i=0 to JobVariables.Count-1

   var=JobVariables(i)

next

If the variable already exists, its value is replaced. If the variable does not exist it is added.

Count

Returns the number of variables in the collection

Remove

Removes the variable with the specified key or index:

JobVariables.Remove("somekey")

JobVariables.Remove(1)

Add

Adds a new item to the collection, and indicates whether the variable should be added to the Windows environment variables for any programs run by the job:

JobVariables.Add "SomeVariable","The Value",true

Methods

LogMessage Method

The LogMessage method writes a message to the Job Log for the executing job. The method has the following syntax:

LogMessage messageType, messageCode, message