Executing a Script File

FastSSR PC can execute multiple commands in succession by placing them in a Script file. Script file commands include FSEND, SEND, FRECEIVE and RECEIVE, but also include other commands which are specifically designed for host session control during FastSSR PC Script file processing. Listed below is the syntax for these commands.

By default, all FastSSR PC Script files end with an .SSR extension, although this is not a requirement. Script files are built by using an ASCII text editor and placing file transfer commands, one per line, into the file. Unlimited blank lines and comment lines, which begin with REM or a single quote, are permitted and are ignored.

Note: Sample FastSSR Script files are included in the \SAMPLES subdirectory of the FastSSR PC installation directory.

If desired, an FastSSR Script file name may be used as a command-line operand for FastSSR PC. Copy the FastSSR PC program shortcut icon to one with a different name. Edit its properties, and specify the Script file name desired at the end of the command line. This is useful when setting up Host-initiated applications for users. They can simply click on an icon rather than starting FastSSR PC, selecting the File Menu, choosing Run Script File, and specifying or selecting a Script file name.

In order to remain compatible with existing DOS batch files, FastSSR Script processing ignores the CLS command. In addition, any command preceded by an at sign “@” will have it stripped off before processing by FastSSR. Line labels are supported by placing a colon “:” in the first column, followed by the label. The case of the line label is not significant and it may contain any valid ASCII character except a blank. Lines containing a line label may not contain any other commands.

FastSSR Script file commands may be continued from one line to the next by placing a plus sign “+” as the last character in the line to be continued. Comments are not permitted on lines that are continued. Note: Using long filenames with FastSSR PC Scripting – FastSSR PC Script commands that specify a PCfilespec as part of their syntax accept long filenames as long as they are enclosed within double quotes. For example:

LOGFILE "C:\FastSSRPC\SAMPLE.LOG" REPLACE INFO

Script file processing supports symbolic variable substitution at virtually any location within a command buffer. Script commands such as FIND, GET, PROMPT, and SET can store data in a symbolic variable. The format of the variable names is similar to that of DOS batch files - % followed by a single digit (0 through 9). Variables are passed to nested Script files (using EXECUTE). The variables may be modified within the lower-level Script file, however these changes do not effect the variable values in the invoking Script. Variables may be placed at virtually any point in a command buffer, or may even represent an entire command buffer. FastSSR substitutes the current values for each of the variables prior to command execution.

Available FastSSR Script file commands include: (Syntax and descriptions of these commands follow)

  • CHDIR
  • CHDRIVE
  • COMPRESS
  • CONNECT
  • CREDNAME
  • DECOMPRESS
  • DELETE
  • DISCONNECT
  • DOSCMD
  • ECHO
  • EHLLAPIRESET
  • END
  • ENDPOINTID
  • EXECUTE
  • FILEINFO
  • FIND
  • FRECEIVE
  • FSEND
  • GET
  • GOTO
  • IF
  • JOINMEM
  • LOGFILE
  • MAP
  • MESSAGES
  • MKDIR
  • ON
  • PAUSE
  • PROMPT
  • PUT
  • RECEIVE
  • REM
  • RENAME
  • RMDIR
  • SEND
  • SET
  • SPLITMEM
  • TRACEFILE
  • TRIM
  • UNMAP
  • WAIT
  • WINCMD

CHDIR changes the current directory during Script file processing.

CHDIR directory-name

CHDRIVE changes the current drive during Script file processing.

CHDRIVE drive-letter

COMPRESS compresses a source file onto itself. Currently, repeated character compression is the only type supported. Specify the CRLF and ASCII values that would normally be used on the file during a SEND operation. When the file is sent to the host, do not specify values for CRLF and ASCII, as these settings are stored in a compression header record within the file.

COMPRESS    PC-filespec
            CRLF|NOCRLF
            ASCII|NOASCII
            TEXT|BINARY
            TYPE(Repeated Character)

CONNECT creates a communications link between the application program (FastSSR PC) and one of the configured terminal sessions. The session-short-name in the syntax below may be specified with or without a trailing colon. FastSSR PC must be “CONNECT-ed” to a terminal session before issuing any Script file command which attempts to communicate with that session (i.e., FIND, GET, PUT, WAIT).

CONNECT     SESSION(session-short-name)

CREDNAME sets the host credentials Name for the username and password passed to the host during a FastSSR (TCP/IP) transfer. The specified value must match a pre-defined Host Credential and must be set before issuing the FSEND and FRECEIVE commands.

CREDNAME    host-credential-name-value

DECOMPRESS decompresses a file that was previously compressed by FastSSR PC or FastSSR Server. All information required to decompress the file and restore it to its original form is stored in a compression header record within the file.

DECOMPRESS  PC-filespec

DELETE erases one or more files on disk. Standard wild-card characters are supported within the PC-filespec.

DELETE  PC-filespec

DISCONNECT cancels the communications link between the application program (FastSSR PC) and one of the configured terminal sessions. Since there may be only one active link at any given time, DISCONNECT does not require any operands. It cancels the active link. FastSSR will not report an error if a DISCONNECT is performed with no links active.

DISCONNECT

DOSCMD executes the remainder of the command line as a DOS command. A command name specified without an extension is assumed to be an EXE file. Therefore, if the command is a BAT, COM, or PIF type file, include the extension as part of the command name. All operands specified are passed to the DOS command unchanged, although symbolic variable substitution may have occurred. FastSSR Script processing waits until the specified command completes before continuing. Also see also the description of the WINCMD Script command.

DOSCMD  command-to-execute

ECHO (or ECHO.) will write any text following the command into the FastSSR Script log file. If there is no data following the ECHO command, a blank line is written. Echo-d lines are written to the Log file in all cases - even when MESSAGES LEVEL(BRIEF) is specified.

ECHO    [text-written-to-the-log]

EHLLAPIRESET resets the EHLLAPI including all internal pointers and variables to their default values.

EHLLAPIRESET

END immediately terminates processing of the FastSSR Script file.

END

ENDPOINTID sets the host Endpoint ID for FastSSR (TCP/IP) transfers. This must be set before using the FSEND and FRECEIVE commands.

ENDPOINTID host-endpoint-id

EXECUTE allows one FastSSR Script file to transfer control to another Script file. The nesting of Script files may occur to a level of 5 deep, however recursive references are prohibited. The EXECUTE command is very useful when downloading (RECEIVE-ing) a file from the host containing other SEND or RECEIVE commands. After the RECEIVE is complete, the downloaded file may be executed immediately. This is particularly useful during Batchinitiated operations where one common list of SEND and RECEIVE operations can be maintained on the host for many PC users to access.

EXECUTE PC-filespec

FILEINFO obtains the requested information about a PC file and places it in the specified variable. The return value for ATTRIBS consists of the capitalized first letter of the name of the attribute that is set. For example, a hidden file returns H in the variable. A system and hidden file returns HS in the variable. If there are no attributes set, “NONE” is returned. If the file is not found, “NOT FOUND” is returned.

FILEINFO    PCFN(pc-filespec)
            [DATE|TIME|SIZE|ATTRIBS]

FIND locates data on the logical screen. The entire screen is searched from top to bottom. If the search-text is found, its location is returned as row,column in the variable specified. If not found, the value stored in this variable is “0,0”. This variable may be specified in a successive command by entering the variable name where a row and column should be specified. LOCATE specifies the row and column at which the search is to begin. Currently 1,1, is the only LOCATE value supported. RETURN can be specified to control whether the row,column returned (hence the cursor location) is AT the first position of the found data, or at the first position AFTER the found data.

FIND    [LOCATE(1,1)]
        TEXT(search-text)
        [RETURN(AT|AFTER)]

FRECEIVE transfers a file from the Host to the PC using the FastSSR (TCP/IP) environment. The syntax below shows the basic parameters only. See the FastSSR documentation for more detailed information on the syntax. In order for FastSSR to issue a FRECEIVE command, the ENDPOINTID and CREDNAME commands must have been issued with valid settings and an internet connection must be present. If the destination directory does not exist, FastSSR will fail the transfer with a return code of 13.

FRECEIVE    PC-filespec
            Host-filename
            [CRLF]
            [ASCII]

FSEND transfers a file to the Host from the PC using the FastSSR (TCP/IP) environment. The syntax below shows the basic parameters only. See the FastSSR documentation for more detailed information on the syntax. In order for FastSSR to issue a FSEND command, the ENDPOINTID and CREDNAME commands must have been issued with valid settings and an internet connection must be present. If the source directory does not exist, FastSSR will fail the transfer with a return code of 13.

FSEND       PC-filespec
            Host-filename
            [CRLF]
            [ASCII]

GET obtains data from the connected host session and stores it in a symbolic parameter (variable) which can later be used in other FastSSR Script file commands. The format of the variable names is similar to that of DOS batch files - % followed by a single digit (0 through 9). Variables are passed to nested Script files (using EXECUTE). The variables may be modified within the lower-level Script file, however these changes do not effect the variable values in the invoking Script. Specifying CAPS converts the string to uppercase before storing it in the variable. RETURN can be specified to control whether the cursor position is left AT the first position of the found data, or at the first position AFTER the found data.

GET     [LOCATE(row,column)|current-cursor-position]
        [LENGTH(number-of-characters)|1]
        [CAPS|ASIS]
        [RETURN(AT|AFTER)]

GOTO transfers control to a different portion of the Script file. The only valid operand is a line label. The leading colon is optional. The case of the line label is not significant. It may contain any valid ASCII character except a blank.

GOTO    line-label

IF transfers control to a different portion of the Script file based upon the result of a logical comparison. If either value to be compared is enclosed within single quotes or is an invalid numeric, a text comparison is performed. Otherwise, the comparison is done on the numeric values of the fields. The branch is taken to the GOTO linelabel if the comparison of the values yields a logical TRUE result. The values to be compared may contain Script variables. All operands in the syntax shown below must be specified. Valid comparators are: =, <>, >=, <=, >, and <. The= =symbol for equals is also supported to retain compatibility with DOS batch file processing.

IF  value-1
    logical-comparator
    value-2
GOTO
    line-label

JOINMEM combines one or more PC files into a single combined file. PDS member delimiters are added by default, but may be omitted. The FILES parameter may specify a single PC file, or may specify a PC filespec that includes wildcards to join multiple files with one command. If the combined file exists, it may be replaced, or the additional file(s) may be appended to it.

JOINMEM     Combined-PC-filespec
            FILES(PC-filespec-to-Join)
            [REPLACE|NOREPLACE|APPEND]
            [PDSDELIMITERS(YES|NO)]

LOGFILE allows for the saving of FastSSR Script status and error messages to a PC file. The LOGFILE command may be issued at any point in Script processing, however only Script commands executed after the log is open are logged. Options include the ability to either over-write or append to an existing log file, and change the output record length of the log file (minimum of 40). In addition, specifying INFO on a LOGFILE open command causes environment information to be written to the log. The log file is closed by FastSSR if it is still open when the highest level Script file terminates.

LOGFILE     PC-filespec
            [REPLACE|APPEND|CLOSE]
            [RECLEN(record-length|80)]
            [INFO]

MAP assigns a drive letter to a network resource.

MAP     DRIVE(drive-letter)
        PATH(network-UNC-name)
        PASSWORD(access-password)

MESSAGES controls the type of messages that are displayed to the FastSSR Script status window, as well as written to the Script log file. LEVEL(BRIEF) displays only the most important messages involving file transfers, severe errors, and echo statements. LEVEL(DEFAULT) includes a description of what happens at each Script file command. LEVEL(DEBUG) includes much more detailed information about what is occurring and can assist during the development of a Script file. In addition, the MESSAGES command controls whether the DATE and TIME (international short format) are displayed at the beginning of each Script log file message. The MESSAGES command may be issued multiple times throughout the execution of a Script file to change these setting as needed.

MESSAGES    [DATE|NODATE]
            [TIME|NOTIME]
            [LEVEL(BRIEF|DEFAULT|DEBUG)]

MKDIR creates a new directory or subdirectory during Script file processing.

MKDIR   directory-name

ON ERROR controls the action of the Script file in case of an error during processing. CANCEL cancels the Script file; CONTINUE ignores the error and continues; PROMPT causes a message to be displayed asking the user if processing should be canceled; RESTORE restores the value to what it was prior to invoking a lower-level Script; and GOTO transfers control to a line-label within the Script.

ON TERMINATION controls the action of FastSSR upon Script file termination. SHUTDOWN causes FastSSR to shut down after the Script file completes; NOSHUTDOWN stops at the Script status screen; DEFAULT shuts down FastSSR if the Script file was invoked from a command line, but stops at the status screen otherwise; and RESTORE restores the value to what it was prior to invoking a lower-level Script.

ON EXECCANCEL controls the return from a lower-level Script in which CANCEL has been specified or forced. The default, PROCESS, causes the CANCEL to be processed and all pending Script files are canceled; while IGNORE allows a higher-level Script file to continue processing and ignore a CANCEL request from a lower-level Script file. ON may be specified multiple times during the execution of a Script file in order to specify different actions based upon what point the Script file processing has reached. The different settings may also be combined on the same

ON  ERROR(CANCEL|CONTINUE|PROMPT|RESTORE|GOTO line-label)
    TERMINATION(SHUTDOWN|DEFAULT|NOSHUTDOWN|RESTORE)
    EXECCANCEL(IGNORE|PROCESS)

PAUSE causes FastSSR Script file processing to temporarily pause for the specified number of seconds before continuing. This is helpful with certain emulation packages that do not recover immediately after a SEND or RECEIVE operation. If another SEND or RECEIVE is attempted immediately, sometimes an error will result. If your emulation package gets errors when multiple SEND and/or RECEIVE operations are attempted, place a PAUSE between them. A 1 or 2 second PAUSE is usually enough to allow the emulation program to reset and be ready for the next operation.

PAUSE   [number-of-seconds|1]

PROMPT processing requests input from the PC user and stores the input data in a symbolic parameter (variable) which can later be used in other FastSSR Script file commands. The PROMPT command can optionally include a default value. In addition, the PIN (Print-inhibit) keyword allows for the field in which the user types to be nondisplay. Any typed characters are replaced with an asterisk (*). The format of the variable names is similar to that of DOS batch files - % followed by a single digit (0 through 9). Variables are passed to nested Script files (using EXECUTE). The variables may be modified within the lower-level Script file, however these changes do not effect the variable values in the invoking Script. Specifying CAPS converts the string to uppercase before storing it in the variable.

PROMPT  [TEXT(Displayed-prompt-string)]
        [DEFAULT(Displayed-default-value)]
        [PIN]
        [CAPS|ASIS]

PUT processing passes either text or keystrokes to the connected host session. The LOCATE operand is used to specify a specific screen location for the placement of the text. Special keys may be sent with the KEYS operand. Multiple keystrokes may be sent with the KEYS operand by separating them with a blank, or comma. For password fields, use the PIN (Print INhibit) keyword to suppress the display of the text in the Log file and on the FastSSR status window while executing. RETURN can be specified to control whether the cursor position is left AT the first position of the found data, or at the first position AFTER the found data.

PUT     [LOCATE(row,column|current-cursor-position)]
        [TEXT(text-string)|HEX(Hex-bytes)|KEYS(special-key-list *)]
        [RETURN(AT|AFTER)]
        [PIN]
        * All special keys below accept (n|1) operand (i.e., TAB(5) indicates 5 successive tab keys)
        ALT ERASEEOF, EOF
        BACKTAB HOME
        CLEAR INSERT, INS
        CURSORDOWN, CURSDOWN, DOWN NEWLINE
        CURSORLEFT, CURSLEFT, LEFT PF1-PF24
        CURSORRIGHT, CURSRIGHT, RIGHT PA1-PA3
        CURSORUP, CURSUP, UP RESET
        DELETE, DEL SHIFT
        ENTER, TAB

RECEIVE transfers a file from the Host to the PC. The syntax below shows the basic parameters only. See the FastSSR Server documentation for more detailed information on the syntax. Each emulation package also supports its own variations of the RECEIVE command syntax, so it would also be helpful to check the documentation that came with your emulation package. In order for FastSSR to issue a RECEIVE command, an active connection must not exist between FastSSR and the session to which the transfer is directed. If an active connection does exist, FastSSR will automatically DISCONNECT from that session before performing the RECEIVE. After the RECEIVE, FastSSR will attempt to reconnect to that session. However, in certain cases it may be necessary to issue another CONNECT command after the RECEIVE is complete. If the destination directory does not exist, FastSSR will fail the transfer with a return code of 13.

RECEIVE     PC-filespec
            [session-short-name]
            Host-filename
            [CRLF]
            [ASCII]

REM, or a single quote, at the beginning of a record indicates that the entire record is treated as a comment. Comments may also be placed after a command on a record by leaving a space following the last operand, then typing a single quote followed by the comment.

REM (or use a single quote)

RENAME will rename an existing file on the PC. Rename can be used to move a file from one directory to another, but cannot be used to create a new directory. Rename will not move a file from one drive to another.

RENAME  Old-PC-filespec
        New-PC-filespec

RMDIR deletes a directory or subdirectory during Script file processing.

RMDIR   directory-name

SEND transfers a file from the PC to the Host. The syntax below shows the basic parameters only. See the FastSSR Server documentation for more detailed information on the syntax. Each emulation package also supports its own variations of the SEND command syntax, so it would also be helpful to check the documentation that came with your emulation package. In order for FastSSR to issue a SEND command, an active connection must not exist between FastSSR and the session to which the transfer is directed. If an active connection does exist, FastSSR will automatically DISCONNECT from that session before performing the SEND. After the SEND, FastSSR will attempt to reconnect to that session. However, in certain cases it may be necessary to issue another CONNECT command after the SEND is complete.

SEND    PC-filespec
        [session-short-name]
        Host-filename
        [CRLF]
        [ASCII]

SET clears or sets a specified value into a symbolic parameter (variable). The format of the variable names is similar to that of DOS batch files - % followed by a single digit (0 through 9). Variables are passed to nested Script files (using EXECUTE). The variables may be modified within the lower-level Script file, however these changes do not effect the variable values in the invoking Script. SET also supports setting a variable equal to certain FastSSR system variable values. A description of each of the values that may be returned by the SET command follows its syntax

SET     [VALUE(string-to-associate-with-variable)|{null-string}
        |LASTCC|MAXCC|DATE|DAY|JULIANDAY|MONTH|YEAR|YEAR2|TIME|HOUR|MINUTE
        |SECOND|DAYOFWEEK|PCENV|HOSTENV|COMMMETHOD|EMULATOR|SSRINFO
        |SSRMSG|CANCELSTATUS]

  • CANCELSTATUS returns a numeric value indicating the Cancel Status of a lower level Script file. 0 indicates Cancel was not requested, 4 that Cancel was requested, and 8 that Cancel was forced due to a critical error.
  • COMMMETHOD returns the communications method used.
  • DATE returns the system date as formatted by the short date definition in the Windows International settings dialog.
  • DAY returns the two-character representation of the current day.
  • DAYOFWEEK returns the character representation of the current day of the week
  • DAYOFWEEK3 returns the first three characters of the current day of the week
  • EMULATOR returns the string shown on the Emulator Settings menu corresponding with the chosen emulation software package.
  • HOSTENV returns the Host environment as set on the FastSSR Environment Menu.
  • HOUR returns the two-character representation of the current hour as formatted by the short time definition in the Windows International settings dialog.
  • JULIANDAY returns the character representation of the current julian day.
  • LASTCC returns the return code of the last file transfer command that was executed.
  • MAXCC returns the highest return code of all file transfers executed since the highest level Script file began executing.
  • MINUTE returns the two-character representation of the current minute.
  • MONTH returns the two-character representation of the current month.
  • PCENV returns the PC environment, or operating system.
  • SECOND returns the two-character representation of the current minute.
  • SSRINFO returns a string containing the name of the FastSSR program, along with its current version.
  • SSRMSG returns a message after the execution of certain FastSSR Script commands such as WAIT which helps to determine if the command timed-out.
  • TIME returns the system time as formatted by the short date and short time definitions in the Windows International settings dialog.
  • YEAR returns the four-character representation of the current year.
  • YEAR2 returns the two-character representation of the current year.

SPLITMEM splits a file that was previously combined by FastSSR PC or FastSSR Server. Optionally, a destination directory and filename extension may be specified. The current directory with no filename extension is used by default.

SPLITMEM    Combined-PC-filespec
            [DIRECTORY(directory-name)]
            [EXTENSION(filename-extension)]
            [REPLACE|NOREPLACE]

TRACEFILE turns the EHLLAPI trace facility on or off. The TRACEFILE command may be issued at any point in Script processing, however only EHLLAPI commands executed after the file is open are traced. When tracing has been turned on, FastSSR places trace information in a file called ASISSR.TRC, located in the user’s private directory. The trace file may optionally be REPLACE-d or APPEND-ed to when opened. Once the trace file has been opened, it will trace all EHLLAPI calls (both Script and interactive) until it is explicitly turned off, or until FastSSR is exited.

TRACEFILE   [REPLACE|APPEND|CLOSE]

TRIM removes both leading and trailing spaces from the specified symbolic parameter (variable). The format of the variable names is similar to that of DOS batch files - % followed by a single digit (0 through 9).

TRIM    text-string

UNMAP releases a previously mapped network resource.

UNMAP   DRIVE(drive-letter)

WAIT processing allows the PC to wait until a specific date, time, or host event before continuing. If a TEXT string is specified with a date and/or time, the date and time represent a time-out value. DELAY may be used to wait a specified number of seconds after the WAIT is satisfied. The INTERVAL operand specifies how often the program should check for the specified condition (maximum of 60 seconds). A longer interval allows more time for other programs to continue processing.

WAIT    [LOCATE(row,column|current-cursor-position)]
        [TEXT(text-string)|NOTTEXT(text-string)|
        HEX(hex-bytes)|NOTHEX(hex-bytes)]
        [DATE(date-to-wait-to|current-date)|DAYS(number-of-days-to-wait|0)]
        [TIME(time-to-wait-until|current-time)]
        [DELAY(number-of-seconds-after-wait-satisfied|0)]
        [INTERVAL(number-of-seconds-between-checks|10)]

WINCMD executes a Windows or DOS command in a window. A command name specified without an extension is assumed to be an EXE file. Therefore, if the command is a BAT, COM, or PIF type file, include the extension as part of the command name. All operands specified are passed to the command unchanged, although symbolic variable substitution may have occurred. If a command has parameters passed to it, they are done using the CMDPARM parameter. This was introduced in version 8.0.0 of the FastSSR PC. WAIT specifies that the FastSSR Script waits until the specified command completes before continuing. NOWAIT specifies that the FastSSR Script continues processing as soon as the command is invoked. FOREGROUND indicates that the window should receive the focus (i.e., become active), whereas BACKGROUND indicates that it does not. WINDOW allows for the specification of the type of window in which the application is started. Also see the description of the DOSCMD Script command. The optional parameter OUTPUT will list the DOS command line output for the COMMAND being executed. This would normally be used when debugging a script. The output is listed in a window as well as written to the script log.

WINCMD  COMMAND(command-to-execute)
        [CMDPARM(parameters for the COMMAND)]
        [WAIT|NOWAIT]
        [FOREGROUND|BACKGROUND]
        [WINDOW(NORMAL|MINIMIZED|MAXIMIZED)]
        [OUTPUT]