Scripting Guide

NAURTECH WEB BROWSER AND TERMINAL EMULATION FOR WINDOWS CE AND WINDOWS MOBILE
CETerm Scripting Guide Page 106
function ExpectMonitor_Abort()
{
// Stop any timer
if (this.timer != null)
{
CETerm.ClearTimeout( this.timer );
this.timer = null;
}
// Set state to beyond reasonable range
this.state = 1000;
}
// Method definitions
ExpectMonitor.prototype.Check = ExpectMonitor_Check;
ExpectMonitor.prototype.Schedule = ExpectMonitor_Schedule;
ExpectMonitor.prototype.Start = ExpectMonitor_Start;
ExpectMonitor.prototype.Abort = ExpectMonitor_Abort;
ExpectMonitor.prototype.OnDone = null;
// Check every 200 milliseconds
ExpectMonitor.prototype.checkDelta = 200;
// About 10 seconds for each text check
ExpectMonitor.prototype.maxCheckCount = 50;
// Allow messages
ExpectMonitor.prototype.silent = false;
// Class statics
ExpectMonitor.Instances = [];
5.1.3 Automating Tasks with Expect
Any routine prompt-and-response task can be automated with “expect”.
Examples may be navigating through a hierarchy of menus or closing an order
for shipping. In any case, you identify text to find on the screen and the user
input to take you to the next screen. Here is a simple menu traversal:
// Traverse menu
expect( CETerm.ActiveSession, 8000,
"3. Applications", "3\r",
"2. Inventory", "2\r",
"2. Put Back", "2\r" );