OnAbort Event (AProgram, ADriver, ASystem)

Occurs when the application is aborted.

Syntax

Object.OnAbort()

The OnAbort event syntax has the following parts:

 

Name

Type

Description

Object

AProgram, ADriver or ASystem

Module object

Comments

The OnAbort events apply to the Program, Driver and System modules. ATEasy will call first the Program OnAbort event (if one is running) then the System Drivers (if exist in your project), and last the System (if exist in your project). If the event procedure does not contain code then ATEasy will not call the event. After all the OnAbort events are called ATEasy will output to the log "...Application Aborted." if the log output is on (SetLogOn) and if the Log variable is set to a log control.

The OnAbort events are called after the Abort statement is called or after the user press Abort on the default error message box when a run-time error occurred.

The following list shows the order of OnAbort events combined with default output when abort is done in the middle of a running program (see ModuleEvents.prj example for more information):

 

 

...Application aborted

   * Program.OnAbort

   * Driver2.OnAbort

   * Driver1.OnAbort

   * System.OnAbort

   * System.OnEndSystem

   * Driver2.OnEnd

   * Driver1.OnEnd

   * System.OnEnd

Use the OnAbort events to perform cleanup and to turn off instrument power before the application is existed. You can also redirect ATEasy to ignore the abort 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 exit the application and to call OnEnd events.

Example

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

Program.OnAbort()

{

! ... program cleanup code ...

print "Program "; Program.Name; " has cleaned up after the application has aborted."

}

Applies to

AProgram, ADriver, ASystem

See Also

OnEnd, Abort Statement, Run Statement, Task Statement, Test Statement, Abort Events, About Module Events