8 the onprogramexit event, Syntax, Example – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual
Page 91: 9 the onprogramstart event

N
AURTECH
W
EB
B
ROWSER AND
T
ERMINAL
E
MULATION FOR
W
INDOWS
CE
AND
W
INDOWS
M
OBILE
CETerm Scripting Guide
Page 91
4.8
T
HE
O
N
P
ROGRAM
E
XIT
E
VENT
The OnProgramExit event is fired just before CETerm exits. This handler can
abort the exit to keep CETerm running.
Syntax
function OnProgramExit ( )
This handler has no arguments. The function returns 0 to continue with the exit
or 1 to abort the exit.
Example
This example prevents the CETerm exit if any session is connected.
/* OnProgramExit */
function OnProgramExit ( )
{
// Don’t exit if any session is connected
for (var i=1; i<=CETerm.MaxSession; ++i)
{
if (CETerm.Session(i).IsConnected)
{
// Switch to first connected session
CETerm.PostIDA( "IDA_SESSION_S" + i, 0 );
// Abort exit
return 1;
}
}
// OK to exit
return 0;
}
4.9
T
HE
O
N
P
ROGRAM
S
TART
E
VENT
The OnProgramStart event is fired just before CETerm starts processing user
input. All command line arguments are processed and auto-connect sessions
are connected before this event.