Script

A Script allows you to store and execute a script (written in a language such as VB.NET, VBScript, or Windows PowerShell) from adTempus.

Scripts can make use of common code stored in Script Libraries and can interact with the adTempus server.

Script Implementation

When you create a new script in adTempus, the Script Editor provides a skeleton script that shows how to structure your script and interact with adTempus. The way that you implement your script differs depending on the scripting technology being used, as discussed in the following sections.

.NET Scripts

A .NET script is implemented as a class that inherits from the UserScriptBase class or one of its specialized subclasses. The base class for your script will depend on the context for which the script is being created. For example, a script created to select files for a File Trigger, the base class will be FileTriggerScriptBase. The skeleton script provided by the Script Editor will derive from the correct base class for the context.

Within the skeleton class provided by the Script Editor, you override the Run method to perform the necessary processing and return a result to adTempus. The value that you need to return will depend on the context in which the script is being used; the comments in the skeleton script will provide details.

The methods and properties of a global object named adTempus allow the script to interact with the adTempus server to do things like getting Job Variable values and logging messages to the Job Log.

.NET scripts can make use of Script Libraries written in any .NET language (for example, a VB.NET script can reference a Script Libary written in C#) .

.NET scripts can also reference external .NET assemblies that are available on the adTempus server.

Script Parameters

The script base class exposes a Parameters property, which provides information about the current job and step, and provides the information that your script needs to perform its work if it is serving as an Extension Script.

The type of this Parameters object will depend on the context for which the script is being created. For example, when your script dervices from FileTriggerScriptBase, the Parameters property will be of type IFileTriggerParameters, which provides information about the files found by the trigger. Your script can then review those files and indicate to adTempus whether it should trigger the job.

Windows Script Host Scripts

Windows Script Host (WSH) scripts (e.g., VBScript, JScript) are implemented as a global code block. You can also create functions within the script.

WSH scripts can only reference Script Libraries that are written using the same language.

The methods and properties of a global object named adTempus allow the script to interact with the adTempus server to do things like getting Job Variable values and logging messages to the Job Log.

Script Parameters

adTempus passes parameters to a WSH script through the adTempus.JobVariables collection. For example, if you create a script to evaluate files for a File Trigger, adTempus will pass information about the files to evaluate through Job Variables. The help topic for each adTempus object that can call scripts will indicate the Job Variables that it sets when calling the script.

When creating Extension Scripts you are encouraged to use on of the .NET languages instead of a WSH language, because those scripts provide tighter integration with adTempus.

Windows PowerShell Scripts

Windows PowerShell scripts are only supported as Task Scripts (i.e., as the target of Script Execution Tasks) and cannot be used as Extension Scripts (e.g., to select files for a File Trigger).

When you run a PowerShell script, adTempus automatically inserts an object named "$adTempus" (of type IApplicationIntegration) in the script to support interaction with the adTempus server.

PowerShell scripts can "include" shared PowerShell scripts stored in adTempus. When you include a script, adTempus writes that script to disk at runtime so that your primary script can call it. This allows you to reuse blocks of PowerShell code, similar to the way that Script Libraries work for Scripts.