User manual - Scripting_Guide

NAURTECH SMART CLIENTS FOR WINDOWS CE AND POCKET PC
CETerm Scripting Guide Page 25
SendText( text, session )
SendText sends a text string to the specified session. Valid session values are
1-4. The special session value of 0 will send the command to the current
session. This command is synchronous and CETerm will act on each character
before this method returns.
The text string may include IDA symbolic names between backslash characters
‘\’. The IDA codes will be interpolated as the text is sent. For example,
“username\\IDA_FIELD_EXIT\\secretpassword”. Note that each backslash has a
preceding backslash because it has special meaning within a JavaScript string.
Session ( index )
Return the corresponding Session object. Valid index values are 1 to the
MaxSession property value. The object is returned even if the session is not
connected.
intervalTimerID = SetInterval( scriptExpression, delayMillisec )
Set a recurring interval timer to execute the scriptExpression after each delay of
delayMillisec. This method returns an ID that should be saved in a global variable
for later use with ClearInterval 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. Interval timers
should 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.