Compiling window scripts with the Script utility
This topic includes the following sections:
Once you have created a script file, it must be processed for use by UI Toolkit. The Script compiler converts window and column scripts into window and column definitions. These definitions are then loaded into a window library (ISAM file) created by Script. (Proto, Composer, and the Script compiler in SDI can also compile a script file.)
If ISAMC_REV is set to 4 when the Script utility is started, window libraries compiled by Script will work with Synergy 9.5.3 and higher. If ISAMC_REV is not set (or is set to 6) when Script is started, the window libraries it compiles will work with Synergy 10 and higher.
You can compile scripts in the following ways:
- Run the Script compiler interactively, providing the necessary information when prompted (see below)
- Run the Script compiler using the command-line syntax (see Running Script using the command-line syntax)
- Access the Script compiler from your application using the external routine interface (see Accessing the Script compiler using the external routine interface)
Running Script interactively
When you run Script interactively, it will prompt you for the information it needs. Files are compiled one at a time, but after compiling a file, you’ll be prompted to compile another.
1. | Start Script with your system’s execute command. |
On… |
Do this… |
---|---|
Windows and UNIX |
At a command prompt, enter dbr WND:script |
OpenVMS |
At a command prompt, enter run WND:script |
Script will display this prompt:
Window Libr:
2. | Enter the name of the window library that will contain the compiled window and column definitions. Script will search for an existing library and modify it by loading the specified script files. If you append /c (or /C) to the library name, Script either creates a new library file, if it doesn’t already exist, or completely overwrites the existing library. |
You are then prompted with the following:
Script File:
3. | Enter the name of the file that contains the window script(s) that you want to compile. The default extension is .wsc. |
- If Script cannot find or create the library file, it displays an error message then waits for valid input.
- If Script cannot save because of locked window library records, it waits two seconds and tries again. Script attempts this ten times before displaying a message and prompting you again for a filename.
- Script cannot process a line that is longer than 255 characters.
4. | After Script creates the window library, it prompts for another script file. Type another filename or press Enter at the prompt to exit. (Alternatively, you can type an end-of-file character to exit.) |
When Script ends, it will exit with a status of D_EXIT_FAILURE if it encountered any errors (0 on OpenVMS, 1 on all other systems). Otherwise, it will exit with a status of D_EXIT_SUCCESS (1 on OpenVMS, 0 on all other systems). Most operating systems have commands that enable you to test for the exit status. See the documentation for your operating system for more information. |
Running Script using the command-line syntax
Running Script from the command line enables you to compile multiple files at once. You can also put these commands in a batch file to build windows quickly and automatically.
On Windows and UNIX, from the command line run:
dbr WND:script [-c library_name|-l library_name] [-i script_file[, ...]] [,-o error_file]
On OpenVMS, define a symbol and then run the command:
script:==$WND:script.exe run script [-c library_name|-l library_name] [-i script_file[, ...]] [,-o error_file]
Arguments
-c library_name
Create a new library. The default extension is .ism.
-l library_name
Specify an existing library. The default extension is .ism.
-i script_file [, …]
Specify one or more script files that you want to compile. The default extension is .wsc.
-o error_file
Specify an error log file. The default extension is .err.
Discussion
When running Script from the command line, you must specify either a library name or script file(s). The library can be one that already exists (-l) or a new one (-c)—but not both.
If no library file is specified, library_name will default to the same base name as the first script file specified, but with the extension .ism. (This works only with an existing library file; it will not create a new one.)
If no script file is specified, then a single script will be processed which has the same name as the library file specified, but with a .wsc extension.
The -i argument can list up to 2,048 script files, which are processed in the order they are specified. Note, however, that the number of script files you specify with -i could be limited by command-line interpreter (shell) limitations. (On Windows, for example, cmd limits command-line length to 8,192 characters.) If you need to process more script files than you can specify on the command line with the -i argument, use the SCR_ routines to create a program that processes script files in a loop (see Accessing the Script compiler using the external routine interface).
Specify -o to write error output to a file. If there are no errors, there will be no file. If -o is not specified, error output is directed to standard output (the terminal).