Script() action

Overview
The Script action executes a script as a child process of the emulator. A script is an executable program. (By contrast, the Source action reads a file containing a list of actions, and executes them one after the other.)

Parameters
The syntax for Script is as follows:
 * [option...] script-name [argument...]


 * option
 * All Script options begin with a  character.


 * script-name
 * The name (full pathname if necessary) of an executable program to run.


 * argument
 * The balance of the parameters as passed as command-line arguments to the program.

Options
-async
 * Asynchronous script. The Script action returns immediately, without waiting for the program to exit. Unless -nostdoutredirect is also given, any output from the program will be reported with a pop-up.

-nolock
 * Do not disable the keyboard while the script is running. (Normally the keyboard is disabled during script execution, so user actions do not interfere with the operation of the script.)

-nostdoutredirect
 * Do not redirect standard output and standard error from the script. Without this option, the result of the Script action is the output from the program.

-single
 * If a socket is used with the s3270 protocol, the emulator will accept just a single connection and then close the listener.

Blocking behavior
Script blocks until the program exits. This can be overridden with the -async option.

Communication between the script and emulator
There are three different ways that a child script can communicate with the emulator.

On POSIX, pipes will be created for communicating with the emulator via the s3270 protocol. The file descriptor number for the pipe for passing commands to the emulator is passed to the program via the  environment variable. The file descriptor number for the pipe for returning results back to the emulator is passed to the program via the  environment variable.

On all platforms, the script can use a socket and the s3270 protocol to communicate with the emulator. The  environment variable gives the TCP port to connect to.

On all platforms, the program can use HTTP requests to communicate with the emulator. The  environment variable gives the base of the URL to connect to.

Return value
Script returns the output of the program. This can be overridden with the -nostdoutredirect option. Script will fail if the program exits with non-zero status.

Examples
Run a typical script. Script(MyScript,first,foo)