Scripting Guide

NAURTECH WEB BROWSER AND TERMINAL EMULATION FOR WINDOWS CE AND WINDOWS MOBILE
CETerm Scripting Guide Page 95
{
// Check RF status
var status = CETerm.GetProperty ( "device.rf.status" );
if (status <= 0)
{
OS.Alert( "No RF signal detected.\n" +
"Return to RF coverage and reconnect." );
return;
}
// Attempt to reconnect to host
CETerm.PostIDA( "IDA_SESSION_CONNECT", session );
}
4.14 THE ONSESSIONRECEIVE EVENT
The OnSessionReceive event is fired when a terminal emulation session
receives data from the connected host. The handler can be used to detect
screen content such as an error message and perform a desired action.
Syntax
function OnSessionReceive ( session, count )
session index of session which received data.
count count of bytes received.
Example
This example will check the screen content on line 24 looking for an error
message. If found, the error is displayed as a popup message.
/* OnSessionReceive */
function OnSessionReceive ( session, count )
{
// Get line of text
var s = CETerm.Session( session ).Screen;
var line = s.GetTextLine( 24 );
// Do a regular expression case-insensitive match
if (line.match( /error/i ))
{
OS.Alert( "Error: " + line );
}
}