4 script and log example – YSI Data Scout Advanced User Manual

Page 70

Advertising
background image

YSI Incorporated

Data Scout Advanced

66

script’s execution (they show the latest executed command, and latest received response, respectively). Each has a normally-check
option check box. Uncheck these options if you do not wish these status boxes to be used to indicate the current state of command
execution.

To start executing the Script file click the Execute button. The button will be then be renamed Abort Script to stop it. The main status
box will turn bright yellow and a circular “lamp” (under the Abort Script button) will alternate yellow/gray for each command line
executed.

Another button labeled Skip Cmd will be enabled while the script is being executed. Use it only if you discover (by observing the
Latest Command: text box) that some transducer command or meta-command has “hung” the Script program or if some wait meta-
command (timed delay) is taking a bit too long. A small light blue text box will also appear on the form (near the lamp) only when a
wait meta-command is being executed and will indicate as “down-count” of the time (in seconds) still remaining in that delay.

The Skip Cmd. button will only abort the current command’s text line, and force the script to move on to the next text line. This
button may also be occasionally renamed Resume if any pause meta-command is encountered while executing the script. Such a
meta-command simply displays a “prompt” message to the user in the Last Command: status box, and “hangs” the script indefinitely
until the user responds to the message’s instructions.

Once execution begins the Script (.cmd) file will open and its text lines will be counted on a first pass. A second pass of the file will
read all its text lines and store them into a dynamically allocated string array in main memory. The file is then closed while it is being
executed. Next, the Log file is opened (if optioned) as a new text file. This file will record and annotate all actions that need to be
recorded during the execution of the script. For long scripts, the Log file may also grow very large particularly if the script contains
loops.

The first pass of the two-pass script file reading process (called the Pre-Compile phase) will seem essentially instantaneous unless the
file is extremely long. It is necessary to read the file’s lines into memory to allow the commands to be executed randomly due to the
possibility of loop meta-commands being allowed in a script file (see

Appendix C

for a description of all Script commands and meta-

commands). The only disadvantage is that the practical length to any script file is ultimately limited by the available “virtual” and
“real” memory space allocated to the Data Scout Advanced application by Windows

®

. If the Pre-Compile phase discovers “looping”

meta-command errors, the script will be self aborted before the Log file is opened. In this case, the main status box turns bright
orange, and a message is displayed there to indicate that no Log file was even written.

If a bad transducer command is encountered in the script during execution that the program recognizes as illegal or unknown, the
script will self-abort if the Stop on Err. option box remains checked. The Log file may then be displayed (by clicking the View/Edit
button in its selection frame) to ascertain the cause. An error message at the end of the Log file will indicate the reason for the abort. If
the script is known to contain such bad commands, then uncheck this option, and re-execute the script. Such errors will be recorded
to the log, but otherwise ignored. This allows the script to continue execution even with errors.

The Annotate Log (checked by default) and Convert Data (unchecked by default)options being selected (checked) cause the maximum
amount of information annotation of each command line and each response line to be added to the Log file automatically during a
script’s execution. Select Convert Data only if you want certain acquired Streams of binary data, or certain command responses with
similar binary data, to be converted into readable numerical numbers. The user might find such extravagance undesirable if it is a
“time critical” sequence of commands in a script, and wish to minimize the overhead of the script program itself thus disabling these
options. For the same reason, the user might wish to prevent the Latest Command: and Latest Response: status boxes being updated
continuously during script execution, in which case the user could also disable the Show Commands and Show Responses options.
Finally, disable the Log file being written entirely to achieve minimum script execution overhead.

After a script’s execution has completed, the bright yellow main status box turns bright green to indicate success. If the script self
aborts this status box turns bright red.

After the script ends normally (or is aborted) the user may return to the second frame and click the View/Edit button, to review the
Log file just generated. To print or save this file, use the functions of the Text Editor window that appears. This editor will (if properly
configured) also allow the user to open and examine the progress of a partially completed Log file currently being written. This can be
very convenient if the script file takes a long time to execute.

5.1.4 SCRIPT AND LOG EXAMPLE

On the following pages you will find the full printouts of an example Script file (named SdiROTest.cmd) followed by its execution Log
file (named SDI-12.log). The script will execute every read-only command of a transducer for the first (#1) or only transducer defined

Advertising