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.

-Http
 * Listen for HTTP connections from the program. A URL prefix is passed to the program via the  environment variable.

-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
 * In conjunction with -UseSocket, accepts just a single connection on the s3270 listener.

-UseSocket
 * Listen for s3270 connections from the program. The TCP port number for the listener is passed to the program via the  environment variable. This is the default behavior on Windows.

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)

Run a script using the s3270 protocol to communicate back with the emulator. Script(-UseSocket,MySocketScript,foo)

Run a script using HTTP to communicate back with the emulator. Script(-Http,/users/bob/my-http-script)