User manual - Scripting_Guide

NAURTECH SMART CLIENTS FOR WINDOWS CE AND POCKET PC
CETerm Scripting Guide Page 16
/* OnBarcodeRead */
function OnBarcodeRead( session, data, source, type, date, time )
{
// Manipulate barcode data here
// Send barcode to emulator
CETerm.SendText( data, session );
// Return 0 to handle barcode normally
// Return 1 if handled data here
return 1;
}
This handler simply passes the barcode data on to the current session using the
“SendText” method. The return value of 1 tells CETerm not to pass on the
barcode data with the usual wedge technique.
The following OnBarcodeRead handler will prefix 3 zeros to any 8 digit barcode
and pass other barcodes unchanged
/* OnBarcodeRead */
function OnBarcodeRead( session, data, source, type, date, time )
{
// Prefix zeros to short barcodes
if (data.length == 8)
{
data = "000" + data;
}
// Send barcode to emulator
CETerm.SendText( data, session );
// Return 0 to handle barcode normally
// Return 1 if handled data here
return 1;
}
If the OnBarcodeRead handler is defined, it will override any “ScannerNavigate”
handler defined in a web page META tag. The following OnBarcodeRead
handler will pass the scan on to the ScannerNavigate handler for a web browser
in session 2
/* OnBarcodeRead */
function OnBarcodeRead( session, data, source, type, date, time )
{
// Don’t process for browser session
if (session == 2)
{
// Return 0 to handle barcode with ScannerNavigate
return 0;
}