Script files
Structure of script files
Script files are plain text using the ISO-8859-1 character set. A carriage return line feed sequence (CR LF), plain carriage return (CR) and plain line feed (LF) are all accepted as line breaks. In normal text files Windows uses CR LF for line breaks and Unix uses LF, so text files created in either environment can be used as scripts. A script is a series of commands that are executed in the order they appear. Commands are terminated by line breaks. Sequences of one or more spaces and horizontal tabs are white space and separate the commands and their parameters. Keywords are recognised in upper, lower and mixed case.
Commands
delay period
Pause for period seconds before executing the next command.period is a number greater than or equal to zero.
send keys [ timeout period]
Send the keys specified by keys to the host. If the keyboard is locked the script will wait for it to unlock, unless the key to be sent can normally be sent when the keyboard is locked. If after period seconds since the send command started the keys have not been sent and the keyboard is locked then the script fails. keys is a string literal. period is a number greater than or equal to zero.
waitfor text [ timeout period]
Wait for text to be received from the host. If after period seconds text has not been received then the script fails. textis a string literal. period is a number greater than or equal to zero.
set keyboard {on | off}
Enables or disables user keyboard input. By default user keyboard input is disabled while a script is running.
String literals
String literals start with a double quote character (") and end with either another double quote character, end of line or end of file. The following escapes can be used in string literals:
Escape |
Meaning |
\a |
Bell |
\b |
Backspace |
\n |
Line Feed |
\r |
Carriage Return |
\t |
Horizontal Tab |
\ooo |
Character whose encoding is ooo, where ooo is an octal value between 000 and 377 |
\x |
The character x, where x is not one of the recognised escape characters above |
\\ |
Backslash |
\" |
Double Quote |
The waitfor command's text parameter and the send command's keysparameter are string literals. Note that the special meaning of the left square bracket ([) when used in the send command's keys parameter cannot be avoided by preceding it with a backslash (\).
Numbers
Numbers are a sequence of decimal digits (0 to 9) and optionally one full stop (.), which may be preceded by a minus sign (-). For example, the following are valid numbers:
The period parameter of the delay, send and waitfor commands is a number.
Comments
The number sign (#) indicates a comment. The number sign and everything after it on that line are ignored.
JET 3270 keys
3270 keys corresponding to graphic characters are represented by the graphic character, except for left square brackets (see below). 3270 keys that are not graphic characters are represented by a key name enclosed in square brackets ([ and ]). The key names can be in upper, lower or mixed case. The following key names are allowed:
- attn
- backspace
- backtab
- clear
- close
- cursor_down
- cursor_left
- cursor_right
- cursor_up
- delete
- destructive_backspace
- disconnect
- dup
- enter
|
- erase_eof
- erase_input
- fast_down
- fast_left
- fast_right
- fast_up
- field_mark
- home
- insert_mode
- new_line
- pa1
- pa2
- pa3
- pf1
|
- pf2
- pf3
- pf4
- pf5
- pf6
- pf7
- pf8
- pf9
- pf10
- pf11
- pf12
- pf13
- pf14
|
- pf15
- pf16
- pf17
- pf18
- pf19
- pf20
- pf21
- pf22
- pf23
- pf24
- reconnect
- reset
- tab
|
The left square bracket key is represented by two left square bracket characters ([[). Note that a left square bracket preceded by a backslash (\[) does not represent the left square bracket key, it marks the start of a key name, the same as a left square bracket without a backslash.
If a key name is not valid then the script fails.
The JET 3270 keys that can be sent when the keyboard is locked are:
attn reset disconnect
Note that clipboard manipulation keys (clear_selection, copy, cut, paste) cannot be sent.
Host data
Generally data received from the host is filtered to remove everything except graphic characters before being compared against the text of the waitfor command. An exception is control orders, they are passed to the script as the graphic characters they are displayed as. See Filtering of Format Control Orders for details.
Script storage and references
Scripts are text files on either the local file system or a web server and are referenced by file: or http: URLs. The MIME type of a script must be text/plain. Usually the browser will recognise the MIME type of a file: URL as text/plain if the file name ends in ".txt". Most web servers are configured to return a MIME type of text/plain with files whose names have a ".txt" suffix.
For example, the following http: URL could be a script on a web server:
http://www.platypuspartners.com/scripts/logon.txt
The following file: URL could be a script on the hard drive of a Windows machine:
file:/C:/jetscript/auto.txt
The following file: URL could be a script on the file system of a Unix machine:
file:/home/jsmith/jetscript/auto.txt
JET 3270 does not provide tools for creating scripts. A text file editor such as Notepad under Windows or vi or emacs under Unix can be used to create scripts.