
                                                                   Page 10-1
                          Chapter 10 - Script Files

OVERVIEW

Script files allow you to customize The Monitor II and add 
functions that you may need, but are not provided for you. 

Some examples are:

* Automated backup of many separate domains.
* Printing custom reports to the screen, printer or a disk
  file.
* Alarm call-out routines.
* Xmodem file transfers.

In addition, some things require the use of script files:

* Collecting Histories.
* Accessing History graphs and schedules from a graphic
  screen (using a script file pointer. see chapter 4).
* Intelligently responding to alarms.

A script file can be set to execute at pre-determined
intervals (known as auto processing) to do unattended
operations such as calling long distance controllers late at
night when the rates are lower to collect history data,
backup the controllers memory, etc. For more information on
auto processing see section 2.4.

Script files are simply a list of commands that The Monitor
II executes in sequence. A script file is created with your
favorite text editor.

IMPORTANT NOTES

* Script files must be stored in the \MONITOR\SCR directory
  and have the file extension of '.SCR'

* Only one script file may be executing at any one time.

* Script files can be executed from the SYSTEM MENU, the
  CUSTOM MENU, from a graphic screen, or by an alarm
  message. You may also specify a script file on the DOS
  command line when you execute The Monitor II. This script
  file will be run after The Monitor II finishes
  initializing itself.

* There are many examples of script files in the
  \MONITOR\SCR directory of you hard disk. View some of
  these to better understand how they work.

                                                                   Page 10-2

10.1   Writing Script Files

The script file interpreter is an English based process
language very similar  to the BASIC language. Many commands
from the BASIC language have  been  implemented in this
interpreter such as PRINT, IF/THEN/ELSE, FOR/NEXT,  and
other  low level commands. Some  high  level  commands
specific  to  Andover controllers are also  implemented,
such  as CONNECT  with a controller, DISCONNECT from a
controller, LOGON  to  a  controller,  LOGOFF  from a
controller, commands to view  graphic screens, etc.
Following, is a description of the script file interpreter
and how to create you own custom script files.

Script files are created using a standard ASCII text editor.
All script files must have the extension .SCR and be placed
in the \MONITOR\SCR  directory. There are a few simple rules
you must  follow  as you create a script file.

* You may enter a single command on each line of the
  script file or you may separate commands with a colon
  (:) and have many commands on one line, although the
  total length of each line  may not exceed 255
  characters.

* Do not use line numbers. Line labels may  be  used as
  targets of GOTO and GOSUB statements. A line label can
  be up to eight characters, either alphabetic or
  numeric, and must end  with a colon. A line label must
  be on a line by itself.

* An END or RETGRAPHIC statement must appear somewhere in
  your  program. Any number of END or RETGRAPHIC
  statements may appear, but program execution will stop
  when the program reaches the first one.

The script file interpreter will execute statements
sequentially unless the program reaches a GOTO or a GOSUB
statement.  (See  the commands GOTO and GOSUB in the
reference  section   for   more information). Upon reaching
a GOTO or  GOSUB statement, program execution will continue
directly following the line label that is specified in the
GOTO or GOSUB statement. When an END or RETGRAPHIC
statement  is  reached, program execution will stop and
control will return to The Monitor II

                                                                   Page 10-3

10.2   Using Variables in Script Files

There are 26 numeric variables provided for your use. These
variables are named A-Z. No other numeric variables may be
used and  no  other  characters  may be included in the
variable name. These variables  are floating  point in
nature. They may contain the  values  3.4E-38  to 3.4E+38.
Although, when displaying the value of a variable, only  six
characters will be printed. (i.e. 9999.999 would be
displayed as 9999.9). In addition, when a numeric variable
is used for input,  only six characters will be allowed to
be input by the user.

There are also 26 string variables provided. These variables
are  also named  A-Z but these variables must be followed by
a $ to denote that it is a string and no other characters
may be present before or  after the  string variable. These
string variables may contain  strings of alphabetic, numeric
or punctuation characters up to 80 characters in length. If
a command would cause a string to be over 80 characters  in
length, the string will be truncated at 80 characters. A
string may be no characters, one character, or any number of
characters up to 80.

All variables, upon execution of a script are reset. A
numeric  variable will be equal to 0 and string variables
will be set equal to "".

There are also many internal variables that may be accessed
to find the value of a particular parameter.  These
variables may not be  changed.  All  of the internal
variables start with an "@". (See the  following reference
section for a list of these variables and their purposes.

                                                                   Page 10-4

10.3   Math and Calculations in Script Files

Calculations  in  script  files are simple  and
straightforward.  All calculations are computed in a strict
left to right order. No  parenthesis  are  allowed.  Only
the operators  +  (plus),  -  (minus),  / (divide),  and  *
(multiply) are recognized. Since  another  order  of
computation cannot be forced, some calculations will have to
be  rearranged.

EXAMPLE:
        10 + (50 * 5) = 260   in the Andover but,
        10 +  50 * 5  = 300   in script files

        You will have to rewrite this calculation as :

        50 * 5 + 10

Numeric variables and internal variables may be freely mixed
with numbers in calculations.

EXAMPLE:
        A = 50
        B = 100 * C
        PRINT 10 + C * @CONNECTED

        Are all perfectly legal commands.


In the following reference section, a certain format is used
to specify what types of parameters, if any, a command
requires.


   N = Numeric variable
   $ = String variable
  "" = String variable or literal quote.
   # = Number, numeric variable, or calculation

Any time you see two or more of these  identifiers  enclosed
within brackets and separated by commas, this means the
command will accept any one of those variable types.

                                                                   Page 10-5

10.4   Script File Reference

COMMAND:     ALARMCOM

PURPOSE:     To divert all script file communications
             commands to the alarm port.

FORMAT:      ALARMCOM (no parameters)

DESCRIPTION: When  the ALARMCOM command is used, all script
file commands that use the main COMM port will now use the
alarm COMM port.

SEE ALSO:    MAINCOM

EXAMPLE:     ALARMCOM         'switch to ALARM COM port
             HANGUP           'hangup mode on alarm port
             MAINCOM          'switch back to MAIN COM port


COMMAND:     ALARMOFF

PURPOSE:     To disable alarm polling.

FORMAT:      ALARMOFF (no parameters)

DESCRIPTION: When  the ALARMOFF command is used, alarm
polling by The Monitor II will be disabled.

SEE ALSO:    ALARMON 




COMMAND:     ALARMON
        
PURPOSE:     To enable alarm polling.             
        
FORMAT:      ALARMON (no parameters)
        
DESCRIPTION: When  the ALARMON command is used, alarm 
polling by The Monitor II will be enabled. Once every 60 
seconds, The Monitor II will issue the 'MON_PRINT_ALARM' 
command to the controller. See chapter 6 for more 
information.

SEE ALSO:    ALARMOFF

                                                                   Page 10-6

COMMAND:     ALMREPORT
        
PURPOSE:     View the alarm report for the current 
             controller.             
        
FORMAT:      ALMREPORT (no parameters)
        
DESCRIPTION: This command will display the alarm report just 
as if ALARM REPORT was selected from the VIEW menu.

SEE ALSO:    MNTREPORT




COMMAND:     APRINT
        
PURPOSE:     To print text to the alarm printer.
        
FORMAT:      APRINT (see the PRINT command for format)

DESCRIPTION: Will print text to the alarm printer. The 
format of the command parameters is identical to the PRINT 
command.

SEE ALSO:    PRINT, MPRINT




COMMAND:     ASK
        
PURPOSE:     To ask the user a question and get a YES/NO  
             answer.
        
FORMAT:      ASK "","",N
        
DESCRIPTION: This command will display a small window on the 
screen with two text strings that are specified in the first 
two parameters. There will also be a YES and NO button 
displayed. The Monitor II will wait indefinitely for the
user to select YES or NO and place the answer in the numeric
variable specified in the third parameter. 0 = NO, 1 = YES.

EXAMPLE:  ASK "Cannot Connect with Controller",
              "Do You Wish to Try Again?", A
          IF A = 1 THE GOTO TRYAGAIN

                                                                   Page 10-7

COMMAND:     BACKUP

PURPOSE:     To BACKUP a controller's memory to disk.

FORMAT:      BACKUP "parm","controllers name","filename",#

DESCRIPTION: When  the BACKUP command is used, The Monitor
II will backup a controllers memory, just as if the BACKUP
menu function had been selected. The numeric value supplied 
for parameter four should be set to 1 if you want to 
overwrite the existing backup file, or set to 0 to append to 
the existing file. See chapter 5 for more information.


EXAMPLE:     BACKUP "SITE","INFINITY1","INF10000",1
             BACKUP "ALL","INFINITY2","INF20001",0


COMMAND:     BOX
        
PURPOSE:     To draw an empty box on the screen.

FORMAT:      BOX #,#,#,#
        
DESCRIPTION: The box command will draw an empty box on the 
screen in the current foreground color. The parameters are 
two pairs of coordinates: X1, Y1 and X2, Y2. The range for 
the horizontal (X) coordinate are 0 - 639 and the range for 
the vertical (Y) coordinate are 0 - 320.

SEE ALSO:    LINE

EXAMPLE:     BOX 1,1,639,320
             BOX X,Y,X+10,Y+20




COMMAND:     BREAKOFF
        
PURPOSE:     To disable control-break

FORMAT:      BREAKOFF (no parameters)

DESCRIPTION: When  the BREAKOFF command is used, the
control-break keystroke will be ignored.

SEE ALSO:    BREAKON

                                                                   Page 10-8

COMMAND:     BREAKON

PURPOSE:     To enable control-break
        
FORMAT:      BREAKON (no parameters)
        
DESCRIPTION: When  the BREAKON command is used, the control-
break keystroke will cause the script file to abort 
execution.

SEE ALSO:    BREAKOFF




COMMAND:     CIRCLE
        
PURPOSE:     To draw a circle on the screen.
        
FORMAT:      CIRCLE #,#,#
        
DESCRIPTION: The circle command will draw an empty circle on
the screen in the current foreground color. The parameters 
are a pair of coordinates X1, Y1 and a radius. The range for 
the horizontal (X) coordinate are 0 - 639 and the range for 
the vertical (Y) coordinate are 0 - 320. The range for the 
radius is 1 - 400.

EXAMPLE:     CIRCLE 320,160,50
             CIRCLE 320,Y,R+10




COMMAND:     CLEARMESSAGE
        
PURPOSE:     To erase a MESSAGE window. 
        
FORMAT:      CLEARMESSAGE (no parameters)
        
DESCRIPTION: The CLEARMESSAGE command will clear a message 
window that was displayed using the MESSAGE command. This
command does nothing if a message window is not currently 
displayed.

SEE ALSO:    MESSAGE

                                                                   Page 10-9

COMMAND:     CLS

PURPOSE:     To clear the video display screen.

FORMAT:      CLS (no parameters)

DESCRIPTION: The  CLS  command will clear the screen using
the current background color.




COMMAND:     COLOR
        
PURPOSE:     To change the current drawing colors. 
        
FORMAT:      COLOR #,#
        
DESCRIPTION: This command will change the current foreground 
and background colors. Once you change the screen color with 
this command, it will affect all of the screen output 
commands such as PRINT, LINE, CLS, etc. The parameters are 
FOREGROUND COLOR and BACKGROUND COLOR.
        
The available colors are:
 
0 - black     8 - gray
1 - blue      9 - light blue
2 - green    10 - light green
3 - cyan     11 - light cyan
4 - red      12 - light red
5 - magenta  13 - light magenta
6 - brown    14 - yellow
7 - white    15 - bright white


EXAMPLE:     COLOR 0,3    'black on cyan
             COLOR F,B
             COLOR F+2,C * 2


                                                                   Page 10-10

COMMAND:     COMLINK
     
PURPOSE:     To link the MAIN COM port with the ALARM COM 
             port.

FORMAT:      COMLINK  #,#
        
DESCRIPTION: When the COMLINK command is used, all the 
information coming in on the MAIN COM port will be sent out 
directly to the ALARM COM port, and vice versa. This is used 
to give a remote caller access to the controller, or the 
controller access to the alarm port modem. The first 
parameter is the number of minutes of inactivity on the COM 
ports before breaking the connection. 

The second parameter is a carrier detect (CD) monitoring 
flag. The value supplied has the following meaning:

0 = ignore carrier detect on both ports
1 = break the comlink if the MAIN COM port loses CD.
2 = break the comlink if the ALARM COM port loses CD.
3 = break the comlink if either COM port loses CD.

Once a comlink has been established the Monitor II is 
effectively locked up until the comlink is broken. No alarms 
will be received and no auto processes will be executed. 

The comlink will be broken if the sequence '[BRK]' is 
received from either COM port. All five characters [,B,R,K 
and ] must be received in that order, and the BRK must be 
uppercase.

This procedure is fairly complex and is explained in greater 
detail in the appendix.

                                                                   Page 10-11

COMMAND:     CONNECT

PURPOSE:     To connect with a controller.

FORMAT:      CONNECT ""
        
DESCRIPTION: When the CONNECT command is used, the 
controller directory will be searched for a  matching  
description. Any or all of this description may be 
specified. If the specified string is "COL", the first 
entry  with COL in the description will be  used  to 
connect with. This search of the controller directory  is 
not  case sensitive. (i.e. "Col", is the same  as  "COL").  
The  connection process used is identical to the  connection  
process used when CONNECT is selected from the CONTROLLER 
menu. If a user is currently logged into The Monitor II, 
then that users name and password will be used to logon to 
the controller. If no user is logged into The Monitor II, 
then the default username and password specified in the 
controller database will be used. The  success  of  the  
CONNECT command may be tested with the @success variable.   
This variable will be set to 1 if the connection was made 
and set to 0 if the connection was not made.
        
EXAMPLE:     CONNECT "College"
             IF @SUCCESS = 0 THE GOTO TRYAGAIN




COMMAND:     DISCONNECT
    
PURPOSE:     To disconnect from a controller. 
        
FORMAT:      DISCONNECT (No Parameters).
      
DESCRIPTION: The  DISCONNECT  command  is used to  
disconnect  from  a controller which you previously 
connected with using the CONNECT  command. The @success 
variable will be set to  1  if the disconnect was successful 
and 0 if the  disconnect was unsuccessful. 
        
SEE ALSO:    CONNECT

                                                                   Page 10-12

COMMAND:     ELSE
        
PURPOSE:     Can be part of an IF/THEN/ELSE block of 
             statements.
        
FORMAT:      ELSE (No parameters)
        
DESCRIPTION: See the IF statement for more information.




COMMAND:     END
        
PURPOSE:     To stop execution of a script file. 
        
FORMAT:      END (No parameters)
        
DESCRIPTION: When the script file reaches an END statement,  
execution of  the script file will be terminated and control  
will return to The Monitor II program.

SEE ALSO:    RETGRAPHIC




COMMAND:     ERROROFF
       
PURPOSE:     To turn off the disconnect on error flag. 
        
FORMAT:      ERROROFF (No Parameters). 
        
DESCRIPTION: After this command is executed, if an error 
occurs in the script  file,  the program will not disconnect  
from  the current controller. This command should not be 
used while doing auto processing.  

NOTE: ERROROFF IS THE DEFAULT MODE.

                                                                   Page 10-13

COMMAND:     ERRORON
       
PURPOSE:     To set the disconnect on error flag. 
        
FORMAT:      ERRORON (No Parameters).
        
DESCRIPTION: When  the  ERRORON command is used, if an error 
occurs later in the  script  file, the  program will 
disconnect from the current  controller before returning 
control to The Monitor II. If this command is not used or 
the ERROROFF command is used, the  program will  not  
disconnect from the current controller.  This command should 
always be used when doing unattended  auto processing. 

NOTE: ERROROFF IS THE DEFAULT MODE.




COMMAND:     FCLOSE
        
PURPOSE:     To close a previously opened file.
        
FORMAT:      FCLOSE #
        
DESCRIPTION: The  FCLOSE  command  is used to close a  file  
that  was previously  opened  with  the FOPEN  command.  
When  this command  is  used, all information in the  
internal  file buffers  will be written to disk if the file  
was  opened for WRITING or APPEND.  If you wish to again 
access  this file, it must be FOPENed again. Only the file 
numbers  1, 2 and 3 may be used. 
        
EXAMPLE:    FCLOSE 1
            FCLOSE A

                                                                   Page 10-14

COMMAND:     FLUSHBUFF
                     
PURPOSE:     To flush the COM buffer of any and all  
             remaining  characters. 
        
FORMAT:      FLUSHBUFF (No Parameters)
        
DESCRIPTION: The FLUSHBUFF command will remove all 
characters from the COMM  buffer. After this command is 
executed, all  characters  that have been transmitted by the 
controller  but  not yet  removed  from the COMM buffer 
using  the  RECEIVE  or GETBYTE commands will be lost and 
may not be recovered.  
        
Note:  You may find out how many characters there are  in             
the COMM buffer by checking the @BUFFSIZE variable. 




COMMAND:     FOPEN
        
PURPOSE:     To Open a file for READING, WRITING OR APPEND.
        
FORMAT:      FOPEN #, "", [R,W,A]
        
DESCRIPTION: The FOPEN command will open a file on disk. If 
the  FOPEN command  is used with the 'R' parameter, the file  
will  be opened for READING. If the command is used  with  a  
'W' parameter, the file will be opened for WRITING. If  the  
file already exists, the existing file  will  be erased   
and a new file  with that name will be  created. If the 
command is  used  with the  'A' parameter, an existing file 
will be opened and  the file  pointer  set to the end of the 
file  and  any  data written to the file will be added to 
the end of the file.  If the file does not exist, it will be 
created similar to the WRITE option. Only the file numbers 
1, 2 and 3 may be used. 

NOTE: NO ERROR MESSAGES WILL BE DISPLAYED. THE @SUCCESS 
VARIABLE WILL BE SET TO '1' IF THE FILE WAS OPENED, AND SET
TO '0' IF AN ERROR OCCURRED.

EXAMPLE:     FOPEN 1,"history.hst", W
             FOPEN 2, A$, R
             FOPEN 3, A$+".dat", A

                                                                   Page 10-15

COMMAND:     FOR

PURPOSE:     Begins a controlled loop of statements to be
             executed.

FORMAT:      FOR counter = start TO end

DESCRIPTION: The  parameters  of the FOR statement  are  as  
described below. 
        
Counter  - A numeric variable used as the  loop  counter. 
This parameter must be a numeric variable A-Z.
        
Start - the initial value of the counter. 
        
End - the final value of the counter. 
        
The program lines following the FOR statement are executed  
until  the NEXT statement is  encountered.  Then  the 
counter  variable is incremented by 1 and  compared  with
the final  value, end.  If, after this  comparison,  the 
counter is still not greater than end, program  execution 
branches  back to the statement following the FOR  statement  
and  the process is repeated. When the  counter  is greater 
than end, execution continues with the  statement following 
the NEXT statement. This is known as a FOR/NEXT loop. You 
may embed a FOR/NEXT loop inside of  another, but,  when  
the NEXT statement  is  encountered,  program execution  
will always branch to the statement  following the  last  
FOR statement encountered. The  FOR/NEXT  loop will  always  
increment the counter variable  by  1.  You cannot use a 
decremental counter or steps larger than 1. 
        
EXAMPLE:    FOR T = 1 TO 100
                PRINT T
            NEXT

                                                                   Page 10-16

COMMAND:     FREAD
        
PURPOSE:     To  read a string or numeric variable from  a  
             previously opened disk file. 
        
FORMAT:      FREAD #,[N,$]
        
DESCRIPTION: The FREAD command will read the specified 
variable from a previously  FOPENed disk file. The file  
must  have  been opened  for reading. If a string variable 
is  used,  this command will read up to 80 characters from 
the disk  file or  until the first carriage return character 
is  encountered.   The  carriage return character will  not  
become part of the target string variable.  If a numeric  
variable  is  used, the next 6 characters from the  disk  
file will  be  read and those 6 characters will  be  
converted  into the floating point format used by numeric 
variables. If you attempt to FREAD past the end of a file, 
no  error will  be returned but the string variable will be
of  an undetermined  length. You may check for the end  of  
file checking the @EOFx internal variable.  
        
EXAMPLE:     FREAD 1,A$
             FREAD A,D




COMMAND:     FWRITE
        
PURPOSE:     To  write a string of characters or a numeric  
             value to  a disk file. 
        
FORMAT:      FWRITE #,[N,$]
        
DESCRIPTION: The  FWRITE  command will write a literal  
quote,  string variable, numeric variable, or calculation to 
a disk file which may be later read with the FREAD command. 
This file must have been previously opened using the FOPEN
command with the 'W' or the 'A' option. If you try to use
the  FWRITE command on a file that is not open, you will get
a  "File Not  Open" error message.  If you attempt to write
to  a file  that was opened for reading, you will get  a
"File
Mode" error message. When you write a numeric variable to
disk,  the variable will be stored in the same manner  in
which it would be printed, up to 6 characters.

EXAMPLE:     FWRITE 1,A$
             FWRITE A,86*4+312
             FWRITE 2, "TESTING"

                                                                   Page 10-17

COMMAND:     GETBYTE

PURPOSE:     To remove a single character from the COMM
             buffer, and store its' value in a numeric
             variable.

FORMAT:      GETBYTE N

DESCRIPTION: The GETBYTE command is used to remove a single
character from  the COMM buffer and place it in the numeric
variable specified.  If  the  COM buffer is  empty  the
@SUCCESS internal variable will be set to 0, otherwise it
will be set to 1.

EXAMPLE:     GETBYTE A




COMMAND:     GETCHAR

PURPOSE:     To remove a single character from the COMM
             buffer, and store its' value in a string
             variable.

FORMAT:      GETCHAR $

DESCRIPTION: The GETBYTE command is used to remove a single
character from  the COMM buffer and place its' ASCII
character in the string variable specified.  If  the  COMM
buffer is  empty  the  specified string will be set to "".

EXAMPLE:     GETCHAR A$

                                                                   Page 10-18

COMMAND:     GETDAY
        
PURPOSE:     To store the current day of the month in a 
             string variable.
        
FORMAT:      GETDAY $
        
DESCRIPTION: The GETDAY command will set the specified 
string variable equal to the current day of the month. The 
string variable will be set to "01" - "31". A leading zero 
will be added when the day is less that 10.

NOTE: THE CURRENT DAY OF MONTH IS READ FROM THE COMPUTER, 
NOT THE CONTROLLER.
        
EXAMPLE:     GETDAY A$



        
COMMAND:     GETDEFPASS
        
PURPOSE:     To store the current controllers default 
             password in a string variable.

FORMAT:      GETDEFPASS $
        
DESCRIPTION: The GETDEFPASS command will set the specified 
string variable equal to the current controllers default 
password that was specified in the controller database.
        
EXAMPLE:     GETDEFPASS A$




COMMAND:     GETDESCRIPTION
        
PURPOSE:     To store the current controllers descriptive
             name in a string variable.

FORMAT:      GETDESCRIPTION $
        
DESCRIPTION: The GETDESCRIPTION command will set the 
specified string variable equal to the current controllers 
descriptive name that was specified in the controller 
database.
        
EXAMPLE:     GETDESCRIPTION A$

                                                                   Page 10-19

COMMAND:     GETFILENAME
        
PURPOSE:     To store the current controllers default 
             filename in a string variable.

FORMAT:      GETFILENAME $
        
DESCRIPTION: The GETFILENAME command will set the specified 
string variable equal to the current controllers 4 letter 
default filename that was specified in the controller 
database.
        
EXAMPLE:     GETFILENAME A$
        


        
COMMAND:     GETHOUR
        
PURPOSE:     To store the current hour of day in a string 
             variable.
        
FORMAT:      GETHOUR $
        
DESCRIPTION: The GETHOUR command will set the specified 
string variable equal to the current hour of day. The string 
variable will be set to "00" - "23". A leading zero will be 
added when the hour is less that 10.

NOTE: THE CURRENT HOUR OF DAY IS READ FROM THE COMPUTER, NOT 
THE CONTROLLER.
        
EXAMPLE:     GETHOUR A$

                                                                   Page 10-20

COMMAND:     GETINPUT
        
PURPOSE:     To display an input window and prompt the user 
             for input.
        
FORMAT:      GETINPUT $,"","",N,N
        
DESCRIPTION: This function will display a window on the 
screen and prompt the user for input. The first parameter is 
the string variable to store the typed input in. The second 
parameter is the title to display at the top of the window 
and may be up to 50 characters. The third is the prompt 
text, and may be up to 20 characters. The fourth is the 
minimum number of characters to accept. The fifth is the 
maximum number of characters to accept, and can be up to 50.
        
EXAMPLE:     GETINPUT A$, "Filename Entry","Filename:",1,8




COMMAND:     GETKEY
        
PURPOSE:     Wait for a key to be typed by the user.
        
FORMAT:      GETKEY
        
DESCRIPTION: When the GETKEY command is used, the program 
will suspend execution until a key is typed at the keyboard. 
(You  may check  to  see if a key has been hit  with  the  
internal variable  @KBHIT).  After this command is used,  
you  may find  out  which key was hit by using  the  
@KEYCODE and @EXTENDED internal variables. 
  
Note:  When doing auto processing, do not use this command 
unless  you  are  certain there will be  someone  at  the 
keyboard to hit a key, otherwise, program execution  will 
be suspended until a key is hit. 

                                                                   Page 10-21

COMMAND:     GETLOGON

PURPOSE:     To store the current controllers default logon 
             code in a string variable.
        
FORMAT:      GETLOGON $
        
DESCRIPTION: The GETLOGON command will set the specified 
string variable equal to the current controllers default 
logon code specified in the controller database.

EXAMPLE:     GETLOGON A$




COMMAND:     GETMIN
        
PURPOSE:     To store the current minute of the hour in a 
             string variable.

FORMAT:      GETMIN $
        
DESCRIPTION: The GETMIN command will set the specified 
string variable equal to the current minute of the hour. The 
string variable will be set to "00" - "59". A leading zero 
will be added when the minute is less that 10.

NOTE: THE CURRENT MINUTE OF THE HOUR OF DAY IS READ FROM THE 
COMPUTER, NOT THE CONTROLLER.
        
EXAMPLE:     GETMIN A$

                                                                   Page 10-22

COMMAND:     GETMONTH
        
PURPOSE:     To store the current month of the year in a  
             string variable.
        
FORMAT:      GETMONTH $
        
DESCRIPTION: The GETMONTH command will set the specified 
string variable equal to the current month of the year. The 
string variable will be set to "01" - "12". A leading zero 
will be added when the month is less that 10.

NOTE: THE CURRENT MONTH OF THE YEAR IS READ FROM THE 
COMPUTER, NOT THE CONTROLLER.
        
EXAMPLE:     GETMONTH A$




COMMAND:     GETNAME
        
PURPOSE:     To store the current controllers name in a 
             string variable.
        
FORMAT:      GETNAME $
        
DESCRIPTION: The GETNAME command will set the specified 
string variable equal to the current controllers name 
specified in the controller database. This is the name given 
to the controller itself, not the descriptive name.

EXAMPLE:     GETNAME A$

                                                                   Page 10-23

COMMAND:     GETSEC
        
PURPOSE:     To store the current second of the minute in a 
             string variable.
        
FORMAT:      GETSEC $
        
DESCRIPTION: The GETSEC command will set the specified 
string variable equal to the current second of the minute. 
The string variable will be set to "00" - "59". A leading 
zero will be added when the second is less that 10.

NOTE: THE CURRENT SECOND OF THE MINUTE IS READ FROM THE 
COMPUTER, NOT THE CONTROLLER.
        
EXAMPLE:     GETSEC A$




COMMAND:     GETUSERNAME
        
PURPOSE:     To store the current users name in a string 
             variable.
        
FORMAT:      GETUSERNAME $
        
DESCRIPTION: The GETUSERNAME command will set the specified 
string variable equal to the current users name as specified 
with the EDIT USER function.
        
EXAMPLE:     GETUSERNAME A$




COMMAND:     GETUSERPASS

PURPOSE:     To store the current users password in a string
             variable.

FORMAT:      GETUSERPASS $

DESCRIPTION: The GETUSERPASS command will set the specified
string variable equal to the current users password as
specified with the EDIT USER function.

EXAMPLE:     GETUSERPASS A$

                                                                   Page 10-24

COMMAND:     GETVAL

PURPOSE:     To get the value of a controller variable.

FORMAT:      GETVAL "", N
        
DESCRIPTION: When  the GETVAL command is used, the command 
PRINT  followed  by the variable name specified, is 
transmitted  to the controller.  The  value the controller 
returns,  will  be placed in the numeric variables specified 
by N. Any legal controller  point name  may be polled to 
find its value.  If the controller returns the word "ON", 
the numeric  variable will be set to 1. If the controller 
returns "OFF" the numeric  variable will be set to 0.  After 
issuing  the  PRINT command  to the controller, the program 
will time out for a maximum  5 seconds waiting for the value 
to  be  returned from  the controller. If the value is not 
returned within  5 seconds, the numeric variable will be 
undefined. You  may test  for  this  condition using  the  
@SUCCESS  internal variable.  If the command timed out the 
@SUCCESS variable will be equal to 0, otherwise it will be 
set to 1.
        
EXAMPLE:     GETVAL "ZONETEMP",A
             GETVAL A$,B




COMMAND:     GETYEAR
        
PURPOSE:     To store the current year in a string variable.
        
FORMAT:      GETYEAR $
        
DESCRIPTION: The GETYEAR command will set the specified 
string variable equal to the current year. The string 
variable will be set to "00" - "99". A leading zero will be 
added when the year is less that 10.

NOTE: THE CURRENT YEAR IS READ FROM THE COMPUTER, NOT THE 
CONTROLLER.

EXAMPLE:     GETYEAR A$

                                                                   Page 10-25

COMMAND:     GOSUB

PURPOSE:     To execute a subroutine.

FORMAT:      GOSUB <label>

DESCRIPTION: When a GOSUB statement is encountered, the
address of the command  directly  following the GOSUB
command,  will be saved  and program execution will continue
with the command following the label specified in the GOSUB
command. The commands in the subroutine will be executed
normally until a RETURN command is encountered at which
point, the program  will resume execution at the  command
following the GOSUB command.

Note:   You must use a return statement to return from  a
subroutine. Do not use a GOTO statement to jump out  of
the subroutine, otherwise  the internal  stack  of  the
script  file interpreter will be thrown off and  improper
execution of the script is likely.

EXAMPLE:     T=5
             GOSUB CALCIT
             T=10
             GOSUB CALCIT
             END

             CALCIT:
               PRINT "T = ";T * 5 + 2
               RETURN

                                                                   Page 10-26

COMMAND:     GOTO

PURPOSE:     To branch to the line label specified. 
        
FORMAT:      GOTO <label>
        
DESCRIPTION: When  a  GOTO command is encountered,  program  
execution continues  with  the command  following the   line  
label specified with the  GOTO command. This is an 
unconditional  branch. If the line label specified does  not  
exist, you will get an "Undefined Line Label" error and  
program execution will stop. 
        
EXAMPLE:     CONNECT "TEST"
             IF @SUCCESS=1 THEN GOTO CONTINUE 
             ELSE PRINT "COULD NOT CONNECT."
             END
 
             CONTINUE:
             PRINT "CONNECTION SUCCESSFUL."
             END




COMMAND:     HANGUP
        
PURPOSE:     To hangup a mode on a COM port.
        
FORMAT:      HANGUP (no parameters)
        
DESCRIPTION: This command will attempt to hangup the modem 
on the currently active COM port. No logoff will be 
attempted.


EXAMPLE:     LOGOFF          'logoff current controller
             HANGUP          'then hangup the modem
             END

                                                                   Page 10-27

COMMAND:     HEADER

PURPOSE:     To display a header (or title) on the top line
             of the screen.

FORMAT:      HEADER ""

DESCRIPTION: The header command will replace the top menu
bar with the text string specified. This top line cannot be
overwritten by any command other than the HEADER command.

EXAMPLE:     HEADER "Running Script..Please Do Not Disturb."




COMMAND:     HISTFILE

PURPOSE:     To display a line chart of history data that is
             stored on disk.

FORMAT:      HISTFILE #

DESCRIPTION: This command displays history data stored on
disk as line charts. It is exactly as if the user had
selected STORED HISTORY from the VIEW menu. See chapter 7
for more information. The first parameter is the entry
number of the history graph in the SELECT HISTORY screen (1-
50).

NOTE: The Monitor II must be connected with (or OFFLINE
EDITING) a controller for this function to work. The
@SUCCESS internal variable will be set to 0 if the command
fails.

                                                                   Page 10-28

COMMAND:     HISTPAGE

PURPOSE:     To immediately read history data from the
             current controller and display it as line
             charts.

FORMAT:      HISTPAGE #

DESCRIPTION: This command displays history data that is read
from the current controller as line charts. It is exactly as
if the user had selected CURRENT HISTORY from the VIEW menu.
See chapter 7 for more information. The first parameter is
the entry number of the history graph in the SELECT HISTORY
screen (1-50).

NOTE: The Monitor II must be connected with a controller for
this function to work. The @SUCCESS internal variable will
be set to 0 if the command fails.




COMMAND:     HISTSTORE

PURPOSE:     To immediately read history data from the
             current controller and store it in a disk file.

FORMAT:      HISTSTORE #

DESCRIPTION: This command stores history data into a disk 
file that is created automatically when the history graph is 
setup (see chapter 7). This command is the only way to get 
the history data into this disk file. The first parameter is 
the entry number of the history graph in the SELECT HISTORY 
screen (1-50).

NOTE: The Monitor II must be connected with a controller for 
this function to work. The @SUCCESS internal variable will 
be set to 0 if the command fails.

                                                                   Page 10-29

COMMAND:     IF

PURPOSE:     To conditionally execute command(s). 
       
FORMAT:      IF # [=,<,>,<=,>=,<>] # THEN
        
DESCRIPTION: The  IF command will test the condition 
specified and  if the  condition  evaluates true,  program  
execution  will continue  with the statement following the 
THEN.  If  the condition evaluates false, program execution 
will continue  at  the next physical line of the  program.  
You  may place as many commands, separated by colons, as 
will  fit in the 255 character limit.  All of the commands  
following the THEN statement that are on the same physical 
line will  be executed.  All of the commands that you wish  
to execute  must be typed on the same line when writing  the 
script  file. Only numeric variables, calculations,  numbers 
and internal variables may be used in the IF  statement. 
String variables and literal quotes are  not allowed.  
       
The IF command can test for only these conditions:

   Less Than                        (<)  
   Equal To                         (=)
   Greater Than                     (>)
   Less Than or Equal To            (< or =)
   Greater Than or Equal To         (> or =)
   Not Equal To                     (<>)
        
Wise use of IF and ELSE can greatly simplify your script 
file programming.


EXAMPLE:     IF A = 50 THEN A = 1:B = 2:C = 3
              
             IF A < 0 THEN B = 50
             ELSE B = 45

             IF @KEYCODE = 65 THEN GOTO LABEL1
             ELSE IF @KEYCODE = 66 THEN GOTO LABEL2
             ELSE IF @KEYCODE = 67 THEN GOTO LABEL3
             ELSE IF @KEYCODE = 68 THEN GOTO LABEL4
             ELSE END

                                                                   Page 10-30

COMMAND:     INFORM

PURPOSE:     To display an information window.

FORMAT:      INFORM "",""

DESCRIPTION: The INFORM command will display a window on the
screen with two lines of text (supplied as parameters #1 and
#2) and wait for the user to press the 'OK' button.

EXAMPLE:     INFORM "Could Not Connect with Controller.",
                    "Please Reset Modem and Try Again."




COMMAND:     INPUT

PURPOSE:     To input a string or numeric variable from the
             keyboard.

FORMAT:      INPUT [$,N]

DESCRIPTION: When the INPUT command is used, program
execution will be suspended  until  the user presses
[Enter]. If  a  string  variable  has been specified, up to
80 characters may  be typed  by the user before pressing
[Enter]. If a  numeric variable is specified, up to 6
characters may be entered. (Only  the  characters "0 1 2 3 4
5 6 7 8 9 - ."  may  be typed  with numeric variables). If a
string  variable  is specified, the string variable will be
set exactly as the user typed it. If a numeric variable is
used, the  string typed by the user will be converted into a
floating point value used by numeric variables.

Note:  When doing auto processing, do not use this command
unless  you  are  certain there will be  someone  at  the
keyboard to hit a key, otherwise, program execution will
be suspended until [Enter] is pressed.

EXAMPLE:     INPUT A$
             INPUT V

                                                                   Page 10-31

COMMAND:     KBFLUSH

PURPOSE:     To discard all keystrokes waiting in the
             keyboard buffer.

FORMAT:      KBFLUSH

DESCRIPTION: The  KBFLUSH command will clear the keyboard of
all  keys that  have been typed and have not been removed
with  the GETKEY command. The @KBHIT internal variable will
be  set to 0 after this command.




COMMAND:     LINE

PURPOSE:     To draw a line on the screen.

FORMAT:      LINE #,#,#,#

DESCRIPTION: The LINE command will draw a line on the screen
in the current foreground color. The parameters are two
pairs of coordinates: X1, Y1 and X2, Y2. The range for the
horizontal (X) coordinate are 0 - 639 and the range for the
vertical (Y) coordinate are 0 - 320.

SEE ALSO:    BOX

EXAMPLE:     LINE 1,1,639,320
             LINE X,Y,X+10,Y+20




COMMAND:     LOADPCX

PURPOSE:     To load a 'PCX' format drawing from disk.

FORMAT:      LOADPCX ""

DESCRIPTION: This command will load a 'PCX' format drawing
from disk. The screen will always stay in the default
resolution. After loading, the color palette will always be
changed back to the default settings.

SEE ALSO:    SAVEPCX

EXAMPLE:     LOADPCX "DRAWING.PCX"
             LOADPCX "\MONITOR\GRP\SYSTEM1.PCX"

                                                                   Page 10-32

COMMAND:     LOCATE

PURPOSE:     To  position the cursor on the screen.
        
FORMAT:      LOCATE #,#
        
DESCRIPTION: Two numbers must be specified for the LOCATE 
command. The first  number is the X coordinate and must be  
between  0 and 79. The second number is the Y coordinate and 
must be between  0 and 39. After this command is used, the 
screen output will display at the new cursor position.  
        
EXAMPLE:     LOCATE 1,1
             LOCATE A+10,B




COMMAND:     LOGOFF
        
PURPOSE:     To log off of the current controller.
        
FORMAT:      LOGOFF
        
DESCRIPTION: The LOGOFF command will transmit the logout 
commands to the controller. The  LOGOFF  command will NOT 
disconnect from the  controller. (To disconnect from a 
controller see the DISCONNECT command). 
        



COMMAND:     LOGON
        
PURPOSE:     To logon to the current controller.
        
FORMAT:      LOGON
        
DESCRIPTION: The LOGON command will execute a logon, just  
like when the controller is first connected with. If a user 
is currently logged in to The Monitor II, that users name
and password will be used. Otherwise, the default username
and password specified in the controller database will be
used.

                                                                   Page 10-33

COMMAND:     MAINCOM

PURPOSE:     To divert all script file communications
             commands to the main COMM port.

FORMAT:      MAINCOM (no parameters)

DESCRIPTION: When  the MAINCOM command is used, all script 
file commands that use the COMM port will now use the main 
COMM port. This is the default when each script file is 
executed.

SEE ALSO:    ALARMCOM 




COMMAND:     MESSAGE
        
PURPOSE:     To display a message window on the screen. 

FORMAT:      MESSAGE "","",""
        
DESCRIPTION: This command will display a window on the 
screen with three lines of text (supplied by parameter #1, 
#2 and #3). After the message window is displayed, execution 
of the script file will continue. The message window will 
stay on the screen until a CLEARMESSAGE command is executed.

SEE ALSO:    CLEARMESSAGE

EXAMPLE:     MESSAGE "Reading Data From Controller.",
                     "Saving in File 'CTLR.DAT'.",
                     "     Please Wait..."


COMMAND:     MIDSTRING
        
PURPOSE:     To set a numeric variable equal to the ASCII 
             code of a character in a string. 

FORMAT:      MIDSTRING "",#,V
        
DESCRIPTION: This will set the numeric variable supplied as 
parameter #3 to the ASCII code value of one character in the 
string supplied as parameter #1. Parameter #2 specifies 
which character (counting from the left) to use.

EXAMPLE:     MIDSTRING "TEST",3,A  'A = 83 (ASCII 'S')
             MIDSTRING "TEST",2,C  'C = 69 (ASCII 'E')

                                                                   Page 10-34

COMMAND:     MOUSEOFF

PURPOSE:     To turn the mouse cursor OFF.

FORMAT:      MOUSEOFF (no parameters)

DESCRIPTION: Will turn the mouse cursor OFF. The cursor will
stay off until the MOUSEON command is executed, or until The 
Monitor II needs it back on.




COMMAND:     MOUSEON
        
PURPOSE:     To turn the mouse cursor ON.
        
FORMAT:      MOUSEON (no parameters)
        
DESCRIPTION: Will turn the mouse cursor ON. The cursor will 
stay on until the MOUSEOFF command is executed.




COMMAND:     MNTREPORT
        
PURPOSE:     View the maintenance report for the current 
             controller.             
        
FORMAT:      MNTREPORT (no parameters)
        
DESCRIPTION: This command will display the alarm report just 
as if MAINTENANCE REPORT was selected from the VIEW menu.

SEE ALSO:    ALMREPORT

                                                                   Page 10-35

COMMAND:     MODEMCMD

PURPOSE:     To send a command to the modem.

FORMAT:      MODEMCMD ""

DESCRIPTION: Will send a command to the modem. The string
given for parameter 1 will be transmitted to the modem with
a 1/10 second delay between each character.

SEE ALSO:    TRANSMIT, SENDBYTE, HANGUP


EXAMPLE:     MODEMCMD "ATDT 1(317) 555-1212"  'dial out

             MODEMCMD "ATA"                   'answer call

             A$="ATS0=1"
             MODEMCMD A$      'set mode to answer on ring 1




COMMAND:     MPRINT

PURPOSE:     To print text to the main printer.

FORMAT:      MPRINT (see the PRINT command for format)

DESCRIPTION: Will print text to the main printer. The format
of the command parameters is identical to the PRINT command.

SEE ALSO:    PRINT, APRINT




COMMAND:     NEXT

PURPOSE:     To test the condition of a FOR  statement.

FORMAT:      NEXT (No Parameters)

DESCRIPTION: When a NEXT statement is encountered the
counter variable is  incremented  by 1 and compared with the
final  value, END.  If the counter is still not greater than
END,  program  execution branches back to the last  FOR
statement encountered.   (See   the   FOR   statement   for
more information).

                                                                   Page 10-36

COMMAND:     NOSOUND

PURPOSE:     To turn the PC speaker off.

FORMAT:      NOSOUND (no parameters)

DESCRIPTION: Will turn the PC speaker OFF. The speaker will
stay off until the SOUND command is executed.




COMMAND:     NUMTOSTR

PURPOSE:     To convert a numeric value to a string
             variable.

FORMAT:      NUMTOSTR #,$

DESCRIPTION: This will convert a numeric value, or
calculation (given as parameter #1) to a string, and store
it in the string variable specified as parameter #2.

SEE ALSO:    STRTONUM

EXAMPLE:     NUMTOSTR 100+3*2,V$   'V$ = "206"




COMMAND:     OFFEDIT

PURPOSE:     To OFFLINE EDIT a controller.

FORMAT:      OFFEDIT ""

DESCRIPTION: When the OFFEDIT command is used, the
controller directory will be searched for a  matching
description. Any or all of this description may be
specified. If the specified string is "COL", the first
entry  with COL in the description will be  used  to
connect with. This search of the controller directory  is
not  case sensitive. (i.e."Col", is the same  as  "COL").
The  OFFEDIT process used is identical to the process used
when OFFLINE EDITITNG is selected from the SYSTEM menu.
The  success  of  the  OFFEDIT command may be tested with
the @SUCCESS variable.   This variable will be set to 1 if
successful and set to 0 if not successful.

EXAMPLE:     OFFEDIT "College"
             OFFEDIT A$

                                                                   Page 10-37

COMMAND:     PAINT

PURPOSE:     To paint (or fill) an area of the screen with
             color.

FORMAT:      PAINT #,#,#,#

DESCRIPTION: This will fill an area of the screen with
color. The first two parameters are an X, Y coordinate. The
range for the horizontal (X) coordinate is 0 - 639. The
range for the vertical (Y) coordinate is 0 - 320. The third
parameter specifies the color number to paint with. The 
fourth parameter is the border color of the object being 
painted. See the COLOR command for a list of color values.

When this command is executed, painting will begin at the 
specified X, Y coordinate. Painting will continue in all 
directions until the border color (parameter #4) is 
detected.

Note: The area to be painted must be TOTALLY surrounded by
the border color. If even 1 pixel is missing, the entire 
screen may be painted.

EXAMPLE:     'draw a filled in circle
             COLOR 4,3            'FG = RED, BG=CYAN
             CIRCLE 100,100,40    'RED circle at 100,100
             PAINT 100,100,14,4   'fill in with YELLOW   
                                  'stop when RED is detected          




COMMAND:     PAUSE

PURPOSE:     To  suspend  program execution for a specific
             length  of time.

FORMAT:      PAUSE #

DESCRIPTION: The PAUSE command will suspend execution of a
script file for  the specified period of time. These time  
increments are measured as 1/18 of a second. In other words, 
a pause command  with a parameter "18" will pause for  1  
second. This pause is not relative to the speed of the  
computer, the PAUSE command will suspend execution for the  
exact specified  length  of time regardless  of  your  
computer system.  
        
        EXAMPLE:     PAUSE 9   'pause for 1/2 second
                     PAUSE A

                                                                   Page 10-38

COMMAND:     PRINT
        
PURPOSE:     To display information on the video screen. 
        
FORMAT:      PRINT <"",$,B,#,>
        
DESCRIPTION: The  PRINT  command  will display any  type  of  
variable (string  or numeric), literal quotes, single  
numbers or calculated  results. All strings will be printed  
exactly as typed. Numbers will always occupy 6 spaces and 
will be right  justified.  After the  command  is  finished,  
the cursor  position will be at the first column of  the  
row directly  below where the line was printed. You may  
suppress this by adding a semi-colon to the end of the PRINT   
statement.  If  a semi-colon has been  appended, the  new 
cursor position will be at the column directly  following 
the  output. A semi-colon may also be used to print  
different types of variables with the same PRINT commands. 
       
EXAMPLE:     PRINT "HELLO"
             PRINT A$
             PRINT A
             PRINT 54 + 34 - 13/5
             A$="John":PRINT "Hello ";A$;", Please Wait..."




COMMAND:     PSET
        
PURPOSE:     To set a single screen pixel to a color.
        
FORMAT:      PSET #,#
        
DESCRIPTION: This will set a single pixel on the screen to 
the current foreground color. The first two parameters are 
an X, Y coordinate. The range for the horizontal (X) 
coordinate is 0 - 639. The range for the vertical (Y) 
coordinate is 0 - 320. 

EXAMPLE:      PSET 100,150
              PSET A*2,C+B

                                                                   Page 10-39

COMMAND:     RAWXMIT

PURPOSE:     To transmit data to the controller.

FORMAT:      RAWXMIT (see the PRINT command for format)

DESCRIPTION: The RAWXMIT command will send data out to the
controller without converting it first. The TRANSMIT command
will send data out to the controller only after converting
it using the TRANSMIT STRING CODES specified in GENERAL
SETUP. The format of the command parameters is identical to
the PRINT command.

SEE ALSO:    TRANSMIT, PRINT




COMMAND:     RECEIVE
        
PURPOSE:     To  receive  a string or numeric value from  
             the current controller. 
        
FORMAT:      RECEIVE [$,N]
        
DESCRIPTION: The  RECEIVE command will remove a string  of  
characters from the COMM buffer. If a string variable is 
specified, up to  80 characters will be removed from the 
COMM buffer  or up until the first carriage return character 
is received. This carriage return character will not become 
a part  of the  string. If a numeric variable is used  6  
characters will be removed from the COMM buffer and this 6  
character string  will  be  converted to the  floating
point format of numeric variables. The numeric variable will 
be set to this value. If no characters are currently in  the 
COMM  buffer the program will wait up to 5 seconds (this 
timeout can be changed with the RECSETUP command) for  a 
character to be received from the controller, after which 
time  the  command  will be completed  and  the  @SUCCESS 
internal  variable will be set equal to 0.  The  @SUCCESS 
internal  variable  will be set to 1 if the  command  was 
successful.  
        

SEE ALSO:    RECSETUP

EXAMPLE:     RECEIVE A$
             RECEIVE B

                                                                   Page 10-40

COMMAND:     RECSETUP

PURPOSE:     To set the timeout for the RECEIVE command.

FORMAT:      RECSETUP #,#

DESCRIPTION: This command will set the timeout and the
terminating character of the RECEIVE command. The first
parameter is the end-of-line character. The default is 13 
(carriage return) and this is what you should normally 
specify when using this command, although specifying 10 
(line feed) can be useful in some cases.

The second parameter is the length of time The Monitor II 
will wait for a line to be received before giving up. This 
is specified in 1/18th of a second increments (18=1 second). 
The default is 80 for 5 seconds.


EXAMPLE:     RECSETUP 13,18    'only wait 1 sec for line

             RECSETUP 13,10*18 'wait 10 seconds for line

             RECSETUP 10,36  'get characters up to line feed
                             



COMMAND:     RELOAD
        
PURPOSE:     To RELOAD a controller's memory from disk. 
        
FORMAT:      RELOAD "controllers name","filename",#
        
DESCRIPTION: This command will reload the controllers memory 
just as if RELOAD had been selected from the CONTROLLER 
menu. The first parameter is the name of the controller to 
be reloaded. This is the actual name of the controller 
specified in the controller database, not the descriptive 
name. The second parameter is the filename in which to save 
the data. If the third parameter is '1', then the data being 
reloaded will overwrite the data currently in the 
controller. This is identical to the '/O' parameter for the 
Infinity controller. See chapter 5 for more information.

EXAMPLE:     RELOAD "INFINITY1","INF10000",1
             RELOAD "INFINITY2","INF20001",0

                                                                   Page 10-41

COMMAND:     RETURN

PURPOSE:     To return from a subroutine.

FORMAT:      RETURN (No Parameters)

DESCRIPTION: The RETURN command is used at the end of a
subroutine to return  control  to the command  directly
following the matching GOSUB command. A RETURN command must
be  present in  all subroutines. If a RETURN command  is
encountered any  place  other than in a subroutine, you
will get a "RETURN  Without GOSUB" error message and program
execution will stop.



COMMAND:     RETGRAPHIC

PURPOSE:     To stop execution of a script file and return
             to a graphic screen.

FORMAT:      RETGRAPHIC (No parameters)

DESCRIPTION: When the script file reaches a RETGRAPHIC
command,  execution of  the script file will be terminated
and control  will return to last graphic screen viewed.

This command acts just like the END command if there is no
graphic to return to, so it is safe to always use RETGRAPHIC
in place of END.

THIS COMMAND WILL ONLY WORK IF THE SCRIPT FILE WAS EXECUTED
FROM A SCRIPT FILE POINTER OR FROM AN ALARM.


SEE ALSO:    END

                                                                   Page 10-42

COMMAND:     RUN

PURPOSE:     To load and execute another script file.

FORMAT:      RUN ""

DESCRIPTION: The  RUN  command  will load and  execute  the
specified script  file. If the script file does not exist
you  will get  a "File Not Found" error message and program
execution will stop. If the script file does exist it will
be loaded and executed beginning with  the first line of the
script  file.  All variables, numeric  and  string,  will
remain  unchanged.

NOTE: DO NOT INCLUDE THE FILENAME EXTENSION IN THE COMMAND.

EXAMPLE:     RUN "SCRIPT1"

             A$="SCRIPT2"
             RUN A$




COMMAND:     SAVEPCX

PURPOSE:     To save the current screen to a disk file in
             the 'PCX' format.

FORMAT:      SAVEPCX ""

DESCRIPTION: This command will save the current graphic
screen to a 'PCX' format disk file.

SEE ALSO:    LOADPCX

EXAMPLE:     SAVEPCX "DRAWING.PCX"
             SAVEPCX "\MONITOR\GRP\SYSTEM1.PCX"

                                                                   Page 10-43

COMMAND:     SELECTCTRL
        
PURPOSE:     Allow the user to select a controller from the 
             controller database.
        
FORMAT:      SELECTCTRL $,N
        
DESCRIPTION: This command will display the CONTROLLER 
SELECTION screen, just as if the user had selected CONNECT 
from the CONTROLLER menu. After the user selects a 
controller, The Monitor II will store the descriptive name 
of the controller in the string variable given as the first 
parameter. The entry number (1-100) will be stored in the 
numeric variable given as the second parameter.

EXAMPLE:     SELECTCTRL A$,B




COMMAND:     SELECTFILE
        
PURPOSE:     Allow the user to select a file from a scroll 
             list.
        
FORMAT:      SELECTFILE $,"","",N
        
DESCRIPTION: This command will display a list of disk 
filenames, and allow the user to select one. The first 
parameter is the string variable to store the selected 
filename in. The second parameter is the title to display at 
the top of the scroll list window. The third parameter is 
the filespec to use when reading the directory from disk. If 
the fourth parameter is '1', then the filename extension 
will not be displayed. If set to '0', the filename extension 
will be displayed. 

Note: If no file is selected, the length of the string 
variable (parameter #1) will be set to 0. Use the STRINGLEN 
command to test for this.

EXAMPLE:    SELECTFILE F$,"Select a File","\MONITOR\*.*",1
            STRINGLEN F$,L
            IF L < 1 THEN GOTO NOFILE

                                                                   Page 10-44

COMMAND:     SENDBYTE

PURPOSE:     To transmit a single byte to the controller

FORMAT:      SENDBYTE #

DESCRIPTION: The SENDBYTE command will transmit a single
character  to the current controller. This character must be
specified as a number (numeric variable, number  or
calculation). Legal  range  for this character is 0 through
255.  This command is used to send the escape character
(27), XOFF character (19) to  suspend the controllers
transmission or  the  XON character (17) which  restarts
transmission by  the  controller. Other values may also be
sent.


EXAMPLE:     SENDBYTE A
             SENDBYTE @ESC




COMMAND:     SETSTRING

PURPOSE:     To change a single character in a string
             variable.

FORMAT:      SETSTRING $,#,#

DESCRIPTION: This will set a single character in the string
variable specified as parameter #1 to the ASCII code value
supplied as parameter #3. Parameter #2 specifies which
character (counting from the left) to change.

EXAMPLE:     A$="TEST"
             SETSTRING A$,1,66  '66 = ASCII code for 'B'
             PRINT A$           'A$ now = "BEST"

                                                                   Page 10-45

COMMAND:     SHELL

PURPOSE:     To execute a DOS command.

FORMAT:      SHELL ""

DESCRIPTION: The  SHELL command will temporarily suspend
execution  of  the  script  file and load and execute any
DOS  program. (You  must  be sure you have enough memory
for  the  DOS program   to   execute.)  Any  DOS   program
with the extension .COM .EXE .BAT may be specified or any 
internal DOS  command such as DIR or COPY may be specified.  
After the  command  executes, control will  continue  with  
the command following the SHELL command. 
        
Note: While  doing auto processing you must be  sure  the 
command or program executed by the SHELL command does not 
require  user input. If it does require user  input,  you 
must be sure there is someone there to provide this input 
otherwise  program execution will be suspended until  the 
input is provided.  
        
EXAMPLE:     SHELL "DIR"
             SHELL A$




COMMAND:     SOUND

PURPOSE:     To make the PC speaker sound a tone.

FORMAT:      SOUND #

DESCRIPTION: This will turn the PC speaker ON at the
specified frequency. The sound will stay ON until the
NOSOUND or an END statement is executed.

EXAMPLE:     SOUND 1000    'turn speaker on at 1000hz
             PAUSE 18      'pause for 1 second
             NOSOUND       'turn speaker off

                                                                   Page 10-46

COMMAND:     STRINGCMP

PURPOSE:     To compare two strings, alphabetically.

FORMAT:      STRINGCMP "","",N

DESCRIPTION: This command will compare the string supplied
as parameter #1 to the string supplied as parameter #2, and
set the numeric variable specified as parameter #3 to the
following values:

    Less than zero - String #1 is LESS than string #2
     Equal to zero - String #1 is EQUAL to string #2
 Greater than zero - String #1 is GREATER than string #2

This command does a straight ASCII compare (I.E. "aaa" is 
greater than "AAA").
  
EXAMPLE:     A$="JOHN"
             B$="MARK"
             STRINGCMP A$,B$,A
             PRINT A$;
             IF A < 0 THEN PRINT " < ";
             IF A = 0 THEN PRINT " = ";
             IF A > 0 THEN PRINT " > ";
             PRINT B$




COMMAND:     STRINGLEN
        
PURPOSE:     To determine the length of a string variable. 

FORMAT:      STRINGLEN $,N

DESCRIPTION: The  STRINGLEN  command  will set  the  numeric
variable specified equal to the number of characters
contained in the  string specified. The number placed in
the  numeric variable will always be between 0 and 80.

EXAMPLE:     A$="TESTING"
             STRINGLEN A$,A
             PRINT A           'A now = 7

                                                                   Page 10-47

COMMAND:     STRTONUM

PURPOSE:     To convert a string variable to a numeric
             variable.

FORMAT:      STRTONUM "",N

DESCRIPTION: This will convert the string supplied as
parameter #1 to its numeric value and store that value in
the numeric variable specified in parameter #2.

EXAMPLE:     A$="123.94"
             STRTONUM A$,A
             PRINT A           'A now = 123.94




COMMAND:     TRANSMIT

PURPOSE:     To transmit information to the current
             controller.

FORMAT:      TRANSMIT <"",$,N,#>

DESCRIPTION: The TRANSMIT command will transmit any type of
variable, string or numeric, literal quote, numbers or
calculated results).   All  strings will be converted before
transmission, using the TRANSMIT STRING CODES specified in
the GENERAL SETUP. Numbers  will be converted to string
format  and transmit  as  6 characters and will be  right
justified. After the string has been transmitted, a carriage
return / line  feed  sequence will also be  transmitted.
You  may suppress this by appending a semi-colon (;) to the
end of the transmit statement. A semi-colon may also be used
to
transmit  different  types  of variables  with  the  same
transmit command.

EXAMPLE:     TRANSMIT "PRINT AIRHAND1"
             TRANSMIT A$
             TRANSMIT "MODIFY ";68+T;" SETPOINT"

                                                                   Page 10-48

COMMAND:     VIEWGRAPHIC

PURPOSE:     To display a previously built graphic screen.

FORMAT:      VIEWGRAPHIC ""

DESCRIPTION: This command will display a graphic screen,
just as if the user had selected GRAPHIC SCREEN from the
VIEW menu. The first parameter should be the filename
specified in the controller database.

EXAMPLE:     VIEWGRAPHIC "SYSTEM1"




COMMAND:     VIEWSCHEDULE

PURPOSE:     To view (or change) a previously built
             schedule.

FORMAT:      VIEWSCHEDULE ""

DESCRIPTION: When the VIEWSCHEDULE command is used, the
schedule directory will be searched for a  matching
description. Any or all of this description may be
specified. If the specified string is "MAIN", the first
entry  with MAIN in the description will viewed. This search
of the schedule directory  is not  case sensitive. (i.e.
"Main", is the same  as  "MAIN").

EXAMPLE:     VIEWSCHEDULE "Main Floor"
             VIEWSCHEDULE "1"




COMMAND:     WINDOWOFF

PURPOSE:     To prohibit The Monitor II from displaying
             information windows that may halt the progress
             of a script file.

FORMAT:      WINDOWOFF (no parameters)

DESCRIPTION: After this command is executed none of the
information windows that require user input will be
displayed (Could Not Logon, Cannot Connect, etc.). You
should use this command when doing auto processing.

                                                                   Page 10-49

COMMAND:     WINDOWON

PURPOSE:     To enable The Monitor II to display
             information windows on the screen.

FORMAT:      WINDOWON (no parameters)

DESCRIPTION: This command is used sometime after the
WINDOWOFF command. It will once again allow The Monitor II
to display information windows.

You only need to use this command if the script file
previously used the WINDOWOFF command.




COMMAND:     XMODEMREC

PURPOSE:     To receive a disk file over the modem from
             another computer.

FORMAT:      XMODEMREC ""

DESCRIPTION: Parameter #1 is the name of the file to
receive. It can contain a full path and filename. A drive
letter may be included. A script file has been included on
the program diskette that is a fully functional Xmodem file
transfer system.

EXAMPLE:     XMODEMREC "C:\MONITOR\GRP\TEST.GRP"
             XMODEMREC A$




COMMAND:     XMODEMXMIT

PURPOSE:     To transfer a disk file over the modem to
             another computer.

FORMAT:      XMODEMXMIT ""

DESCRIPTION: Parameter #1 is the name of the file to
transmit. It can contain a full path and filename. A drive
letter may be included. A script file has been included on
the program diskette that is a fully functional Xmodem file
transfer system.

EXAMPLE:     XMODEMXMIT "D:\DATA\SYSTEM.DAT"
             XMODEMXMIT A$+".DAT"

                                                                   Page 10-50

10.5    Internal Variables

Internal  variables are read only variables that get their
value  from  the  script file interpreter internally. You
can not change or  modify these variables. You may use these
variables any place where a  number is  required.  You may
also use these variables  within  calculations. Following is
a description of each of the internal variables.


@APRTBUSY     Equals 1 if the alarm printer is BUSY.
              Note: On non-IBM printers the value returned
              may  or  may  not be a correct value depending
              on  the compatibility level of your printer.

@BG           Equals the current background color.

@BUFFSIZE     Equals the current number of bytes in the main
              COMM port buffer. (or alarm COMM port, if the
              ALARMCOM command is used.)

@COLUMN       Equals the current cursor column.

@CONNECTED    Equals 1 if currently connected with a
              controller (may be OFFLINE EDITING).

@CR           Always equals carriage return (ASCII 13).

@CTRLTYPE     Equals -1 if not connected, 0 if connected to
              AC256 or 1 if connected to an Infinity.

@DAY          This variable equals the current day of the
              month in the computer (1-31).

@DOW          This variable equals the current day of the
              week in the computer (1 = SUN, 7 = SAT).

@EOF1         This variable will equal  1 if the  file
              that was specified for reading as number 1 has
              reached the end of the file (if there is no
              information left in the file to read).

@EOF2         This variable will equal  1 if the  file
              that was specified for reading as number 2 has
              reached the end of the file (if there is no
              information left in the file to read).

@EOF3         This variable will equal  1 if the  file
              that was specified for reading as number 3 has
              reached the end of the file (if there is no
              information left in the file to read).

                                                                   Page 10-51


@ESC          This  variable  will always return the value
              27.  It  is useful  with the SENDBYTE
              command for  sending  an ESCAPE character to
              the controller.

@EXTENDED     This  variable  is only given a value after
              the  GETKEY command  is  used.  If the key
              that is  typed  when  the GETKEY  command  is
              used is a  normal  alpha-numeric or
              punctuation character, the @EXTENDED variable
              will  equal 0.  If the key typed is a function
              key, a cursor  direction key or an ALT plus
              other key sequence, @EXTENDED will equal 1.

@FG           Equals the current foreground color.

@HOUR         This variable will always equal the current
              hour in the computer (00 - 23).

@KBHIT        Equals 0 if no characters are waiting in the
              keyboard buffer.  Equals  1 if there are
              characters  in  the keyboard buffer.

@KEYCODE      This  variable is only set after the GETKEY
              command  is executed.  It will equal the
              value of the key that was typed  or  if the
              @EXTENDED variable equals 1,  it  will equal
              the scan code of the key typed. (See Appendix
              for key values).

@LEFTBUTTON   Equals 1 if the left mouse button is currently
              held down. Otherwise, it equals 0.

@LOGGEDON     Equals 1 if the logon of the last CONNECT
              command was successful.

@MINUTE       This variable will always equal the current
              minute in the computer (0 - 59).

@MONTH        This variable will equal the current month in
              the computer (1-12).

@MOUSEX       Equals the current mouse pointer horizontal
              (X) coordinate.

@MOUSEY       Equals the current mouse pointer vertical
              (Y) coordinate.

@MPRTBUSY     Equals 1 if the main printer is BUSY.
              Note: On non-IBM printers the value returned 
              may  or  may  not be a correct value depending  
              on  the compatibility level of your printer. 

                                                                   Page 10-52


@NUMIOUS      Equals the number of IOU's specified in the 
              controller database for the current 
              controller (AC256 only).

@NUMPCUS      Equals the number of PCU's specified in the 
              controller database for the current 
              controller (AC256 only).

@OFFLINE      Equals 1 if currently in OFFLINE editing mode. 
              Otherwise, it equals 0.

@PASSLEVEL    Equals the current users password level. This  
              variable will  always be set equal to 0, 1, 2 
              or 3. Check @USERACTIVE to see if any user is 
              currently logged in to The Monitor II.

@RIGHTBUTTON  Equals 1 if the right mouse button is 
              currently held down. Otherwise, it equals 0.

@ROW          Equals the current cursor row.

@SECOND       This variable will always equal the current 
              second in the computer (0 - 59). 
        
@SUCCESS     This  variable will return the success of  
             certain  commands  such as CONNECT, DISCONNECT, 
             RECEIVE and  so  on. This  variable will return 
             0 if not successful and 1  if successful.
        
@TIMEOUT     Equals 1 if the HISTVIEW, MNTREPORT or 
             ALMREPORT command timed out because of user 
             inactivity.

@USERACTIVE  Will equal 1 if a user is currently logged in 
             to The Monitor II, otherwise, it will equal 0.

@YEAR        This variable will always equal the current 
             year in the computer (00-99).

