Script Processing

Executable objects go through four execution stages. The second one is the generation stage. Scripts are generated during this stage. The time at which the script is generated depends on object attributes. The order in which scripts are processed in an object depends on which Process pages the scripts are on.

This page includes the following:

Execution Stages

To configure the object attributes correctly so that the script elements behave as you expect, you must understand the stages of execution that a task goes through. The task is activated, generated, processed (that is, executed on the target computer) and finally completed.

The following topics describe the execution stages and the individual steps that take place in each stage. Read them before starting with the Automation Engine scripting language:

Time of Processing

The time at which the script is generated depends on the Generate Task at attribute that you define on the object Attributes page. You have two options:

Example

The following script uses a function to set the value of a variable to the current date and time:

:SET &CURRENTTIME# = SYS_TIME()

The actual date and time that the script returns depend on the point in time at which the task is generated. Assume that you have two tasks that are configured differently:

For more information about object attributes that concern generation, see Attributes Page. Read also Generating at Activation or at Runtime, where the implications of choosing either option are described in detail.

Important! If you exit the AWI after starting an object that is configured to be generated at activation, script generation may not have finished. If the script includes elements that require action, such as a :READ statement, you may not get the desired results.

Order of Processing

Depending on the type of object, the task may have more than one Process page on which you can write scripts. The scripts in the Process pages are processed in the following order:

  1. Pre-Process page and Process page
  2. Child Post Process page
  3. Post Process page

For more information, see Process Pages.

Processing In Scripts

The Automation Engine processes scripts line by line. The results of executed script elements (such as the value of a variable that has been set) are regularly written to the AE database. This process is referred to as a commit. Other scripts can only access these new or modified values after the values have been committed.

When scripts run for longer times, the Automation Engine automatically makes a commit every 5 seconds. In addition, some script elements that require processes to complete also result in commits.

Examples

Some script elements start or stop tasks, and wait for the RunID of the task to be returned, therefore resulting in a commit. The following functions are examples of such script elements:

Some script statements require user interaction. The system waits for the user to react, so script statements such as the following also result in a commit:

The :WAIT script statement instructs the system to wait for a specific length of time, and also results in a commit.

Tip: Use :WAIT to enforce a commit.

See also:

seealso

Scripting

Writing Scripts

Script Elements Ordered by Purpose

Alphabetical List of Script Statements and Functions