Translate page

General Syntax Rules and Limitations

 


General Syntax Rules and Limitations

This section explains the general syntax rules for commands in the scripting language for our terminal emulation products. Please read this section carefully before contacting our support staff for assistance regarding the writing of scripts.

 

Some sample scripts to assist you to write scripts can be found in the Script Examples section of this help file.

 

The general syntax for any of the scripting commands is as follows:

  • COMMAND PARAMETER (, OPTIONAL1, OPTIONAL2)

The command can be any command listed in the List of Supported Commands. This is always a single word which can be followed by zero to four parameters, depending on the command. The parameters should be enclosed by the delimiter character which is the double quote (") by default. This can be changed by using the Delimiter comand.

 

Search conditions for conditional commands (if, do, dowhile) can be reversed by using ‘!’ in front of the condition, e.g.

  • dowhile (search, "text")

will execute while "text" is found, while

  • dowhile (!search, "text")

will execute while "text" is not found.

 

It is possible to specify a starting and ending position for all search commands in the following format:

  • If (search, "text, 40/200")

This will search for the specified text only between the starting and ending positions, which can be between 0 and the size of the screen – 1. To calculate the screen size use the formula rows * columns – 1. For a 24 by 80 screen the start and end positions can be between 0 and 1919.

 

The maximum number of variables you can use in one script is limited to 128.

 

The maximum number of characters that can be stored in a variable (see var, varprompt and varextract commands) is limited to 256 characters.

 

Commands are not case sensitive, i.e. ‘CLOSE’ is the same as ‘close’ or ‘CloSE’. Parameters on the other hand are case sensitive. As a result,

  • LOOKFOR "user name"

is NOT the same as

  • LOOKFOR "USER Name".

 

Parameters should be enclosed in delimiters. If a parameter contains one or more spaces, it MUST be enclosed in delimiters. For example, the command

  • CALL C:\windows\notepad.exe is valid,

  • CALL "C:\windows\notepad.exe" is valid,

  • CALL "C:\program files\program.exe" is valid,

  • CALL C:\program files\program.exe is NOT valid (because of the space between ‘program’ and ‘files’).

 

Commands that require conditions (do. . . while, dowhile, if. . . else. . . endif) must use the SEARCH command for the condition. The reason for this is that only the SEARCH command returns a TRUE or FALSE value, all other commands do not return a value, or they wait until the condition is TRUE, like the LOOKFOR command. For obvious reasons, if a command does not return a value, or it always returns TRUE, it can not be used in conditional statements.

You can (please note that Jolly Giant Software does not recommend this) put multiple statements on a single line. Although it is syntactically correct to have a line in the script such as

  • CONNECT "HOST.NAME.NET" LOOKFOR "UID" TYPE "MY NAME" KEY "ENTER"

it will be much easier to maintain and debug the script if the statement is broken into multiple lines. On the other hand command and parameter must be on the same line. As a result,

is NOT valid syntax.

 

There is no need to convert scripts from prior versions of QWS3270 PLUS to the expanded scripting language found in QWS3270 PLUS version 3.4. All commands used in previous versions are still supported. The same does not apply however to using scripts from version 3.4 upwards with older versions of QWS3270 PLUS, since new commands that were added in version 3.4 will not be recognized by older versions.