User manual - Scripting_Guide

NAURTECH SMART CLIENTS FOR WINDOWS CE AND POCKET PC
CETerm Scripting Guide Page 54
this.state = 0;
this.timer = null;
this.checkCount = 0;
this.totalCheckCount = 0;
this.maxCheckCount = this.timeout / this.checkDelta;
// Abort any existing object
if (ExpectMonitor.Instances[this.session] != null)
{
ExpectMonitor.Instances[this.session].Abort();
}
// Record this instance in the global array
ExpectMonitor.Instances[this.session] = this;
}
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)
{