CWTELNET Script Language Syntax

CWTELNET's scripting language provides automation for common login functions that require several steps. The same scripting language is used for CWTELNET, CWTELN32, C_TELNET, and TERM. Using the scripting feature can completely eliminate the login process with the exception of entering your user name and password.

Command Syntax

CONNECT <host address>
This command causes CWTELNET to start a session to <host address>. <host address> can be a local machine name like etsuadmn, admin, etsuodt, www, news, or boisdarc. It can also be a remote machine like tammvs1.tamu.edu or mvs1.cpa.texas.gov. <host address> can be a specific IP address like 165.95.92.5 but this format is discouraged.
DEBUG ON
or
DEBUG OFF
DEBUG ON is the same as /d32 on the command line. DEBUG OFF turns off /D32.
DOWNLOAD KERMIT
or
DOWNLOAD XMODEM <filename>
or
DOWNLOAD XMODEM NOCRC <filename>
The DOWNLOAD command is only implemented in the TERM program. It is included here because the scripting syntax is essentially the same for TERM, C_TELNET, CWTELNET and CWTELN32.
This command receives a file or files from the host system using the specified protocol.
EXIT
Ends the script execution even if end of the script file has not been reached.
GOTO <label>
Causes the scripting engine to locate the specified label and continue execution there. Labels are specified as a single word at the start of a line followed by the colon character. The examples below will demonstrate the use of labels and the GOTO command.
INCLUDE <filename>
Upon encountering an INCLUDE statement, CWTELNET will open the specified file and execute the command within it. When the end of the included file is reached, execution continues at the line following the INCLUDE statement in the current file. CWTELNET allows nesting of INCLUDE statements such that FILE A can INCLUDE FILE B which INCLUDE's FILE C.
ONERROR GOTO <label>
Specifies location to begin execution if an error occurs. CWTELNET defines an error as a WAIT FOR <string> taking longer than the time specified by TIMEOUT.
SESSION <session name>
Allows the user to specify the name for the session. This name will appear on the title bar for the window in CWTELNET. In C_TELNET, this command specifies the name to appear on the right side of the status line. For CWTELNET and CWTELN32, this command must appear before CONNECT. SESSION performs no function for TERM.
SEND <string>
or
SEND ENTER
or
SEND CLEAR
or
SEND F1 through F24
or
SEND BREAK

SEND <string> and SEND BREAK are the only forms valid for TERM.

If SEND <string> is specified then string is a string of characters enclosed in quotation marks. The string can contain escaped sequences as follows:

Sequence Meaning
\\

Causes a single '\' character to be send to the host.

\a

Sends the bell character to the host. The bell character is 0x07.

\b

Sends the backspace character to the host or 0x08.

\f

Sends the form feed character to the host or 0x0C.

\n

Sends the ASCII new line character or 0x0A.

\r

Sends the ASCII carriage return character or 0x0D.

\t

Sends the TAB character or 0x09.

\'

Sends an apostrophe.

\"

Sends a quotation mark character

\v

Sends a VERTICAL TAB character.

\x<nn>

Interprets <nn> as a hexadecimal character

\<nn>

Interprets <nn> as an octal character.

SET <variable> = <value>

Sets the specified variable to the specified value. The valid variables are:

Variable Possible values
$BARCODE_HEIGHT

Specifies the height of barcodes produced by barcode printing escapes.

$LPRT

Sets the LPRT port. The value specified should be 1 for LPRT1, 2 for LPRT2 or 3 for LPRT3

$DISPLAY_MODE

Specifies the mode number to use for input fields. This parameter applies to C_TELNET only. It specifies the rendition to be used for input fields when operating in TN3270 mode. You can select the proper mode by using the ALT-F11 sequence while in a TN3270 session with input fields displayed on the screen.

$PRINT_BINARY

Specify YES to cause this session to print binary output. This applies only to C_TELNET.

$RC

Sets the return code value for C_TELNET. Normally C_TELNET exits with a return code of zero. This can be used to alter the behavior of an MS-DOS batch file.