8 handling javascript literal values – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual

Page 22

Advertising
background image

N

AURTECH

W

EB

B

ROWSER AND

T

ERMINAL

E

MULATION FOR

W

INDOWS

CE

AND

W

INDOWS

M

OBILE




CETerm Scripting Guide

Page 22


case 1: IDA = "IDA_VT_PF1"; break;
case 2: IDA = "IDA_VT_PF2"; break;
case 3: IDA = "IDA_VT_PF3"; break;
case 4: IDA = "IDA_VT_PF4"; break;
}

// DEBUG: Uncomment next two lines for testing
//OS.Alert( "row=" + row + " col=" + column +
// " button=" + button + " IDA=" + IDA );

if (!IDA.match("IDA_NONE"))
{
// Send command
CETerm.PostIDA( IDA, session );
}
}
}


You may have noticed by now the use of PostIDA in some cases and SendIDA
in other cases. SendIDA is a synchronous activation of an action whereas
PostIDA is an asynchronous or deferred activation. In general it is always better
to use PostIDA unless you must wait for the action to complete before
proceeding in the script. The post action is similar to the “PostMessage” function
in Windows programming and the send is similar to the “SendMessage” function.
See the CETerm automation object for more details.

2.8

H

ANDLING

J

AVA

S

CRIPT

L

ITERAL

V

ALUES

The Automation Objects described in Chapter 3 often return JavaScript literal
values when the results are complex. For example, JavaScript literals are
returned when the results are lists of files, lists of processes, or memory
information.

A JavaScript literal is a text string which describes the contents of an array or
object. These literals are easily converted into regular JavaScript arrays or
objects for use by your scripts. This concept of data representation is similar to
the highly popular

“JavaScript Object Notation” (JSON, www.json.org) data

interchange used by web applications. The results in CETerm do not follow the
strict JSON format, but are handled in nearly identical ways.

WARNING: The format and content of JavaScript literals returned by various

CETerm object may vary depending on hardware types or OS
versions. They may also vary with different CETerm versions. You
should review the raw form of the returned values on the devices you
plan to use and program defensively to allow for variations. See the
example below for details.

Advertising
This manual is related to the following products: