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"
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.
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.
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") JobVariables.Item("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 |
The LogMessage method writes a message to the Job Log for the executing job. The method has the following syntax:
LogMessage messageType, messageCode, message
messageType indicates the type (severity) of the message: 1=Informational, 2=Warning, 8=Error, 16=Fatal,32=Debug.
messageCode is a user-defined numeric code that you can use to search for or filter messages in the message query.
message is the message text to log.