Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual
Page 104

N
AURTECH
W
EB
B
ROWSER AND
T
ERMINAL
E
MULATION FOR
W
INDOWS
CE
AND
W
INDOWS
M
OBILE
CETerm Scripting Guide
Page 104
function ExpectMonitor_Check()
{
// Clear timer id
this.timer = null;
// If something to check for, check it.
var target = this.args[this.state];
if (target != null)
{
// Get all screen text
var screenText =
CETerm.Session(this.session).Screen.GetText (1,1,-1,-1);
if (screenText != null && screenText.match( target ))
{
// Found match
var action = this.args[this.state + 1];
this.checkCount = 0;
if (action != null)
{
// Check action
if (typeof action == "function")
{
// Run function action
// Pass session number as argument
action( this.session );
}
else if (typeof action == "string")
{
// Send text to session
CETerm.SendText( action, this.session );
}
else if (!this.silent)
{
OS.Alert("Unknown action type for expect.");
}
}
// Check if another match expected
this.state +=2;
target = this.args[this.state];
if (target != null)
{
// Schedule next check
this.Schedule();
}
else
{
// Done with this expect.