User manual - Scripting_Guide

NAURTECH SMART CLIENTS FOR WINDOWS CE AND POCKET PC
CETerm Scripting Guide Page 57
5.1.3 Automating Tasks with Expect
Any routine prompt-and-response task can be automated with “expect”.
Examples may be navigating through a hierarchy of menus or closing an order
for shipping. In any case, you identify text to find on the screen and the user
input to take you to the next screen. Here is a simple menu traversal:
// Traverse menu
expect( CETerm.ActiveSession, 8000,
"3. Applications", "3\r",
"2. Inventory", "2\r",
"2. Put Back", "2\r" );
This script can be entered into any script slot and bound to a key combination for
activation. You must also load the “expect” and “ExpectMonitor” in a script slot
which is marked “Load at Startup” so that the functions are available for use.
5.2 PRESENTING VISUAL FEEDBACK DURING SCRIPT EXECUTION
The Message object can be displayed during script execution when you want to
provide a visual indication of script progress. The Message object is
asynchronous and a script can continue running while it is displayed. This is
unlike the OS.Alert() message which stops script execution and requires user
confirmation. There is only one Message object within CETerm and you can
change the Message properties within any script.
WARNING: You must exercise caution when using the Message box to avoid
leaving it visible after a script is done. You may want to provide a
cleanup script that can be activated by the user to be sure the
message is hidden.
Following is an example of using the Message box. This message will display
itself for 5 seconds and then disappear.
/* Show message for 5 seconds */
var m = CETerm.Message;
m.Text = "Processing data, please wait.";
m.Timeout = 5;
m.AbortButtonVisible = true; // does nothing because script exits
m.Progress = 0;
m.ProgressRunning = true;
m.ProgressVisible = true;
m.ProgressRate = 20;