11 the onsessionconnect event, Syntax, Example – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual

Page 93: 12 the onsessiondisconnect event

Advertising
background image

N

AURTECH

W

EB

B

ROWSER AND

T

ERMINAL

E

MULATION FOR

W

INDOWS

CE

AND

W

INDOWS

M

OBILE




CETerm Scripting Guide

Page 93


4.11

T

HE

O

N

S

ESSION

C

ONNECT

E

VENT

The OnSessionConnect event is fired when a session initially connects to the
specified host. The handler can be used to initiate an automated login using the
“expect” script and “ExpectMonitor” class.

Syntax

function OnSessionConnect ( session )

session

– index of session which connected.


Example

An example using OnSessionConnect to start the automated login was shown
above in Section 2.6 and is repeated below. Please refer to Section 2.6 for
details. The

“expect” script is discussed in Section 5.1.

/* OnSessionConnect */
function OnSessionConnect ( session )
{
// Set login information
var myusername = "joeuser";
var mypassword = "secret";

var waittime = 8000; // Milliseconds waiting for each text

// Only login session 1
if (session == 1)
{
// Look for "login" then "password"
expect( session, waittime, "Login", myusername + "\r",
"Password", mypassword + "\r" );
}
}



4.12

T

HE

O

N

S

ESSION

D

ISCONNECT

E

VENT

The OnSessionDisconnect event is fired when a session is disconnected by a
user action. The handler can be used to switch to another session, exit, or
perform other cleanup tasks.

Advertising
This manual is related to the following products: