3 limit execution time, 10 debugging scripts, 1 show script errors – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual

Page 120

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 120


5.9.3 Limit Execution Time

Because the script engine acts like a “virtual user”, when a script is executing,
CETerm will seem unresponsive. You cannot have a script running continuously.
However, using events and timers, you can accomplish any task.

Do not disable the “Script Timeout” unless you are sure your script will not enter
an infinite loop.


5.10

D

EBUGGING

S

CRIPTS

All but the most trivial script will require some amount of debugging.

5.10.1 Show Script Errors

The first step is to enable “Show Script Errors”. This will enable a popup
message for compilation and runtime errors. Compilation errors will usually be
seen when new scripts are added or upon script engine startup. It may not be
clear which script loaded at startup contains the error. In this case you may need
to open the edit dialog for each script and tap the “Test/Load” button to identify
the bad script.

The compilation error looks like this:

Microsoft JScript compilation error
[Line: 15 Col: 8] Expected ‘)’
OS.Alert( message );


Notice that the line of script presented looks OK. In this case, the missing „)‟ is
on the previous line of script, but the error is detected as the compiler reaches
column 8 of this line and encounters the „O‟. Be sure to look around the
indicated location to identify the source of the error.

A runtime error may be seen at startup if a script is performing some initialization,
or it may be seen while using CETerm. It can be difficult to identify the source of
the error if the script was fired by an event or timer. Most often, a runtime error
can be prevented by “defensive coding” where you are sure to check the validity
of arguments and object references.

The runtime error looks like this:

Microsoft JScript runtime error

Advertising
This manual is related to the following products: