OnEndTask Event (AProgram, ADriver, ASystem)

Occurs after each of the program tasks finished.

Syntax

Object.OnEndTask()

The OnEndTask event syntax has the following parts:

 

Name

Type

Description

Object

AProgram, ADriver, ASystem

Module object

Comments

The OnEndTask events apply to the Program, System Drivers and System modules. ATEasy will call first the Program OnEndTask, then the System Drivers (if exist in your project) in reverse order, and last the System (if exist in your project). If the event procedure does not contain code then ATEasy will not call the event.

The OnEndTask events are called after each completed task (the last test in the current task is finished). This can happen after the last test in the task is finished or when ExitTask, Task or Test statements were called.

The following list shows the order of OnEndTask events combined with default output (see ModuleEvents.prj example for more information):

 

   * Program.OnEndTest

   * Driver2.OnEndTest

   * Driver1.OnEndTest

   * System.OnEndTest

002 Untitled  Test 2   -      -

   * Program.OnEndTask

   * Driver2.OnEndTask

   * Driver1.OnEndTask

   * System.OnEndTask

   * Program.OnEnd

Use the OnEndTask events to perform cleanup and to turn off instrument power before the application is existed. You can also redirect ATEasy to ignore and not to continue to the next task or test exit by running another program, task or test using the Run, Task and Test statements. If the event returned normally (not ignored) ATEasy will continue to call all the OnEndTask events for other modules and will continue to the next task or test or exit the program if no more task or test are available.

Example

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

prg1.OnEndTask()

{

! ... program cleanup code ...

print "Program "; Program.Name; " has cleaned up after the end of task "; Task.Id

}

Applies to

AProgram, ADriver, ASystem

See Also

ExitTask Statement, Task Statement, Test Statement, OnEnd, OnEndTest, OnInitTask, End Events, About Module Events