OnInitTask Event (ASystem, ADriver, AProgram, )

Occurs before each of program tasks executed.

Syntax

Object.OnInitTask()

The OnInitTask event syntax has the following parts:

 

Name

Type

Description

Object

ASystem, ADriver, AProgram

Module object

Comments

The OnInitTask events apply to the Program, Driver and System modules. ATEasy will call first the Program OnInitTask event then the System Drivers (if exist in your project) and the System. For each task that ATEasy is about to execute ATEasy will call the OnInitTask event. If the event procedure does not contain code then ATEasy will not call the event.

The following list shows the order of OnInitTask events combined with default output (see ModuleEvents.prj example for more information). After the Program OnInitTask is called, ATEasy will output the task header to the log as shown here. After the last OnInitTask is called, ATEasy will output the application header to the log as shown below. The log output can be override to create custom  header using SetLogString function::

 

* Program.OnInit

================================================================================

Program... : Example

UUT....... :

Version... : 1 (Fri Mar 07 08 16:20:17)

Serial #.. :

Start time : 1/26/2010 4:18:09 PM

   * System.OnInitTask

   * Driver1.OnInitTask

   * Driver2.OnInitTask

   * Program.OnInitTask

Task 1 : Untitled Task 1

------------------------------------------

   * System.OnInitTest

Use the OnInitTask events if you need to initialize your system instruments before each task is executed, to customize the test log or any other code that should be called before a task is executed. If the event returned normally (not ignored by calling Run, Task or Test statements for example) ATEasy will continue to call all the OnInitTask events for other modules.

Example

The following is an example of one way to use the OnInitTask event:

Program.OnInitTask()

{

! ... program initialization code ...

print "Program "; Program.Name; " has been initialized for running task "; Task.Id

}

Applies to

ASystem, ADriver, AProgram

See Also

OnEndTask, OnInit, OnInitTest, Run Statement, Task Statement, Test Statement, Initialization Events, About Module Events