Setscripttimeout ( millisec ) – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual

Page 29

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 29


this timer. The scriptExpression is a string containing the script, but is commonly
a function invocation, such as “myTimerFunction( 3, „alert‟ );”

Timers are especially useful with complex or long-running scripts. Interval timers
can be used to perform simple update tasks. One-time timers should be used in
preference to interval timers. In general, scripts should perform a short action
and exit. With a complex script such as a state-machine, the state can be
maintained in global variables and the script re-activated periodically to check for
state transitions and perform actions. See the “expect” script and
“ExpectMonitor” class in Section 5.1 for an example of the use of a timer.

status = SetProperty ( propertyName, propertyValue )

SetProperty will assign the given value to the named property. See Appendix 2
for a list of available properties. The returned status is 0 for success, non-zero
for failure.

SetScriptTimeout ( millisec )

Set the maximum script execution time. This value may be updated during a
running script. If updated, the new timeout will apply starting at the time of the
change. A value of 0 will disable the timeout.

The script timeout prevents a faulty script from locking-up CETerm. For
example, if a script enters an “endless loop”, the timeout will eventually force the
script to abort.

timeoutTimerID = SetTimeout ( scriptExpression, delayMillisec )

Set a one-time timer to execute the scriptExpression after a delay of
delayMillisec. This method returns an ID that should be saved in a global variable
for later use with ClearTimeout if needed. Other scripts may run while waiting for
this timer. The scriptExpression is a string containing the script, but is commonly
a function invocation, such as

“myTimerFunction( 3, „alert‟ );”


Timers are especially useful with complex or long-running scripts. Timers can
also be used to defer an operation which is not possible within an event handler.
One-time timers should be used in preference to interval timers. In general,
scripts should perform a short action and exit. With a complex script such as a
state-machine, the state can be maintained in global variables and the script re-
activated periodically to check for state transitions and perform actions. See the
“expect” script and “ExpectMonitor” in Section 5.1 for an example of the use of a
timer.

Advertising
This manual is related to the following products: