McIDAS User's Guide
Version 2016.2

[Search Manual] [Table of Contents] [Go to Previous] [Go to Next]


BATCH

Runs commands serially from a text file.


Formats

BATCH file [keywords]
BATCH par1 par2 . . parn file [keywords]


Parameters

file

name of the batch file containing the commands; see the Remarks

par1 . . n

value to substitute wherever the corresponding %n notation (%1, %2, etc.) appears in the batch file


Keywords

CONtinue=

NO

stops the batch file if any command stops abnormally (default)

 

YES

ignores any abnormal terminations and continues with subsequent commands

DEST=

name of the text file to write commands into instead of running them; the file contains the list of expanded commands and can be used by other programs

 

C

directs commands to the text frame for viewing only


Remarks

The batch file containing the commands must be in text format, created with a text editor. Commands in the batch file may be up to 512 characters long. Commands are performed serially; each must finish before the next one begins.

Normal string table substitution may be used within each command and will take place as the command is run. Use the TERM command to change the state of the single letter command toggles.

To add a remark in the batch file, specify REM or REM? followed by one or more spaces and the remark text. The letters (REM) must be uppercase and must begin in column 1. Remarks prefaced by REM? are echoed to the text frame.


Pseudocommands

BATCH also allows for some rudimentary flow control by permitting the following eight pseudocommands in the batch file. The term value in the formats below may be up to 512 characters, and is one of the following:

SET variable=value

This pseudocommand replaces the value of the variable, which is only available while the BATCH command is running. Reference the variable elsewhere in the batch file by using %variable% or #variable. If variable is not defined with SET, it is obtained from the McIDAS string table. You can define and use up to 30 variables, which are simply names storing strings of characters. Variable names may be up to eight alphanumeric characters.

SETSTRING string=value

This pseudocommand replaces the value of string in the McIDAS string table.

IF value1==value2 command

This pseudocommand runs the specified command if the two values are identical.

IF NOT value1==value2 command

This pseudocommand runs the specified command if the two values are NOT identical.

IF NOT ERRORCODE command

This pseudocommand runs the specified command if the last McIDAS command completed successfully. (That is, it returned a zero exit status.)

IF ERRORCODE command

This pseudocommand runs the specified command if the last McIDAS command had an error. (That is, returned a non-zero exit status.)

GOTO label

This pseudocommand causes the BATCH command to jump forward to the next line tagged with :label. See the :label pseudocommand below.

:label

This pseudocommand tags a line with a label so that it can be found with the GOTO pseudocommand. The label is a character string of up to 12 characters (for example, DONE!). You can add a comment after the label as long as one or more spaces separate the label and comment.


Examples

BATCH KMIA 0 6 LIST.BAT

If your BATCH file, LIST.BAT, contains the line below, this entry runs the McIDAS command SFCLIST KMIA TIME=0 6.

SFCLIST  %1  TIME=%2  %3

BATCH KTUL DISPLAY.BAT CONTINUE=YES

If your BATCH file, DISPLAY.BAT, contains the lines below, this entry sets the value of the variable ID to KTUL for use in the IMGDISP and PC commands. If station KTUL is in the image, it is displayed with a high resolution map, then the cursor is moved to the station location. If the image doesn't exist or station KTUL isn't in it, the message *** OOPS! Station must be invalid or not on image *** appears on text frame.

SET ID=%1
IMGDISP A.100 STA=%ID%  REFRESH='MAP VH'
IF NOT ERRORCODE GOTO CURSOR
REM? *** OOPS! Station must be invalid or not on image ***
GOTO DONE
:CURSOR
REM? *** Another successful image load! ***
PC L %ID%
:DONE

[Search Manual] [Table of Contents] [Go to Previous] [Go to Next]