









     ************ **     **   *****                    **             **
     **   **   ** **** ****  **   **                                  **
          **      ** *** **  ***       ****   ** ***  ***  ** ****  ******
          **      **  *  **    ***    **  **   **  **  **   **   **   **
          **      **     **      ***  **       **      **   **   **   **
          **      **     **  **   **  **  **   **      **   **   **   ** **
          **      **     **   *****    ****   ****    ****  ******     ***
                                                            **
                                                            **
                                                           ****





                           Telemate Script Language

                                 Version 1.30



                                 By  Tsung Hu




             Copyright (c) 1988, 1989 Tsung Hu.  All rights reserved.

     
     TELEMATE SCRIPT                                TABLE OF CONTENTS    i
     
     TABLE OF CONTENTS


     INTRODUCTION                                                        1
        Using The Compiler  . . . . . . . . . . . . . . . . . . . . . .  1
        Run Script  . . . . . . . . . . . . . . . . . . . . . . . . . .  1
        Hello, world  . . . . . . . . . . . . . . . . . . . . . . . . .  1

     DATA TYPES                                                          2
        Integer . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
        String  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
        Character . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
        Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3

     VARIABLES                                                           4
        Variable Identifiers. . . . . . . . . . . . . . . . . . . . . .  4
        Variable Declarations . . . . . . . . . . . . . . . . . . . . .  4
        Predefined Variables. . . . . . . . . . . . . . . . . . . . . .  4
           CONNECTED  . . . . . . . . . . . . . . . . . . . . . . . . .  4
           FOUND  . . . . . . . . . . . . . . . . . . . . . . . . . . .  5
           SUCCESS  . . . . . . . . . . . . . . . . . . . . . . . . . .  5

     EXPRESSIONS                                                         6
        Rule Of Precedence  . . . . . . . . . . . . . . . . . . . . . .  6
        Arithmetic Operators  . . . . . . . . . . . . . . . . . . . . .  6
        Boolean Operators . . . . . . . . . . . . . . . . . . . . . . .  7
        Relational Operators  . . . . . . . . . . . . . . . . . . . . .  7

     STATEMENTS                                                          8
        Comment . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
        Assignment Statement  . . . . . . . . . . . . . . . . . . . . .  8
        If Statement  . . . . . . . . . . . . . . . . . . . . . . . . .  8
        Switch Statement  . . . . . . . . . . . . . . . . . . . . . . .  9
        While Loop  . . . . . . . . . . . . . . . . . . . . . . . . . . 10
        Repeat Loop . . . . . . . . . . . . . . . . . . . . . . . . . . 11
        Exit Statement  . . . . . . . . . . . . . . . . . . . . . . . . 11

     PROCEDURES                                                         12
        Procedure Declaration . . . . . . . . . . . . . . . . . . . . . 12
        Scope of Variables  . . . . . . . . . . . . . . . . . . . . . . 12
        Calling Procedure . . . . . . . . . . . . . . . . . . . . . . . 13
        Passing Arguments . . . . . . . . . . . . . . . . . . . . . . . 13
        Return Statement  . . . . . . . . . . . . . . . . . . . . . . . 14

     INPUT AND OUTPUT                                                   15
        Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . 15
           Input  . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
           InputCh  . . . . . . . . . . . . . . . . . . . . . . . . . . 15
           Print  . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
           At . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
           Clear Text . . . . . . . . . . . . . . . . . . . . . . . . . 16
           Clear Key  . . . . . . . . . . . . . . . . . . . . . . . . . 16

     
     TELEMATE SCRIPT                               TABLE OF CONTENTS    ii
     
        COM I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
           Get  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
           GetCh  . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
           Put  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
           Clear COM  . . . . . . . . . . . . . . . . . . . . . . . . . 18

        File I/O  . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
           Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
           Create . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
           Append . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
           Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
           ReadCh . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
           Write  . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
           Close  . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

     BUILT IN FUNCTIONS                                                 21
        Append                                                          21
        Alarm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
        Atoi and Itoa . . . . . . . . . . . . . . . . . . . . . . . . . 21
        Clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
        Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
        Concat  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
        Create  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
        Date  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
        Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
        Dial  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
        Dos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
        ExitTelemate  . . . . . . . . . . . . . . . . . . . . . . . . . 24
        Get and GetCh . . . . . . . . . . . . . . . . . . . . . . . . . 24
        HangUp  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
        Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
        Input and InputCh . . . . . . . . . . . . . . . . . . . . . . . 24
        Itoa  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
        LogOff and LogOn  . . . . . . . . . . . . . . . . . . . . . . . 25
        Open  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
        Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
        Put . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
        Receive and Send  . . . . . . . . . . . . . . . . . . . . . . . 25
        Script  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
        Send  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
        Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
        Stop  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
        Time  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
        Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
        Waitfor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
        WaitUntil . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
        When  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
        Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

     
     TELEMATE SCRIPT                              TABLE OF CONTENTS    iii
     
     APPENDIX A: SUMMARY OF STATEMENTS                                  31
        If Statement  . . . . . . . . . . . . . . . . . . . . . . . . . 31
        Switch Statement  . . . . . . . . . . . . . . . . . . . . . . . 31
        While Loop  . . . . . . . . . . . . . . . . . . . . . . . . . . 31
        Repeat Loop . . . . . . . . . . . . . . . . . . . . . . . . . . 31
        Procedure Declaration . . . . . . . . . . . . . . . . . . . . . 31
        Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . 32
        COM I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
        File I/O  . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
        Built In Functions  . . . . . . . . . . . . . . . . . . . . . . 32


     APPENDIX B: ERROR MESSAGES                                         34
        Compiler Error Messages . . . . . . . . . . . . . . . . . . . . 34
        Runtime Error Messages  . . . . . . . . . . . . . . . . . . . . 36

     INDEX                                                              37

     
     TELEMATE SCRIPT                                     INTRODUCTION    1
     
     
     INTRODUCTION

     TMScript is designed to be a  easy-to-use language.  If you have  any
     experience in  the  other  programming language,  you  will  have  no
     problem in writing TMScript files.


     Using The Compiler
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Using TMS.EXE is obvious; at the DOS command line, type

          TMS filename.SCR

     When you type the command, TMS compiles the file and produces a  file
     a file named 'filename.TMS'.  For example, typing 'TMS \TM\HOST.SCR',
     TMS compiles '\TM\HOST.SCR' and produces '\TM\HOST.TMS'.


     Run Script
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     To run a  script, you must  execute TM.EXE. Pressing  [Alt S] at  the
     Terminal Window opens the File Dialog  and you are asked to  identify
     which script file to be executed.  Script files end in the  extension
     .SCR, the source file, or .TMS, the compiled file.


     Hello, world
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The first program to write is the same for all languages.  Print  the
     words

          hello, world

     In TMScript, it can be done in only one statement:

          print "hello, world"

     
     TELEMATE SCRIPT                                       DATA TYPES    2
     
     
     DATA TYPES

     TMScript provides two basic data  types, integer and string, and  two
     extended data types, character and boolean.


     Integer
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Ordinary  number  notation  is  used  for  integers.    Decimal   and
     engineering notation  (e  or  E  followed  by  an  exponent)  is  not
     supported.   Integer  must  within  the  range  from  -2147483648  to
     2147483647.


     String
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     A string is a sequence of zero or more characters from extended ASCII
     character set, enclosed by quotation marks.  A string with nothing in
     it is called  a empty string.   Two sequential  quotation marks in  a
     string denote a single character, an quotation mark.

     TMScript allows control characters  to be embedded  in strings.   The
     '^' character followed by a letter  (A-Z, a-z), '@' or '[' denotes  a
     character  of  the  ASCII  code  Ctrl-a  to  Ctrl-Z,  NULL,  or   ESC
     respective.

     Here are some examples of strings

          "TELEMATE"  "This is a '""'."   "^K^D"


     Character
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Character  is  represented  as  a  string  that  contains  only   one
     character.  For example, "A" is a character.  Control codes are often
     used in script programs and are represented as

          Code   String Description
          ÄÄÄÄÄÄ ÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
          Ctrl-@  "^@"  NULL
          Ctrl-A  "^A"
           ...     ..
          Ctrl-H  "^H"  Backspace
          Ctrl-I  "^I"  TAB
          Ctrl-J  "^J"  LF, line feed
           ...     ..
          Ctrl-M  "^M"  CR, Carriage Return, [Enter]
           ...     ..
          Ctrl-Z  "^Z"
          Ctrl-[  "^["  Escape


     
     TELEMATE SCRIPT                                       DATA TYPES    3
     
     
     Boolean
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Boolean (TRUE or FALSE)  is represented as a  integer.  A integer  is
     said to be TRUE if it is not  equal to zero, FALSE if it is equal  to
     zero.

     
     TELEMATE SCRIPT                                        VARIABLES    4
     
     
     VARIABLES


     Variable Identifiers
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     A variable identifier  can contain  letters and digits.   However,  a
     variable can only start with a  letter.  Case is not significant,  in
     the other word, the variable 'notdone'  is the same as 'NotDone'.   A
     variable identifier  can be  of  any length,  but  only the  first  8
     characters are significant.    For examples, the variable  identifier
     'Number1234' is the same as 'Number12345'


     Variable Declarations
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     A variable declaration embodies a list of identifiers that  designate
     new variables and their type.  For example,

          integer LOWER,UPPER,STEP    ; integers
          string  message,filename    ; strings
          integer TRUE,FALSE          ; boolean
          string  ch,letter           ; character

     The variable declaration part should be placed at the beginning of  a
     script or of a  procedure. In TMScript,  variables need not  declared
     before use  if no  procedure  is defined.   Therefore,  the  variable
     declaration part can be skipped.


     Predefined Variables
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     TMScript built in functions  do not return  value.  Three  predefined
     variables are set to the resulting value.  They are CONNECTED,  FOUND
     and SUCCESS.

     CONNECTED

     When a DIAL statement is executed, CONNECTED is set to the number  of
     the connected entry (from 1  to 100).  A  value of zero, which  means
     FALSE, indicates that the DIAL statement is aborted by operator.  For
     example,

          dial "1 3 6"
          if not connected
             print "Aborted by operator"
             stop
          endif
          switch connected
            case 1: print "connected to #1"
            case 3: print "connected to #3"
            case 6: print "connected to #6"
          endswitch

     
     TELEMATE SCRIPT                                        VARIABLES    5
     
     
     In addition, the variable CONNECTED returns  to FALSE as soon as  the
     carrier lost.  On the other hand, if the state of the carrier changes
     from OFF to ON, CONNECTED is set to TRUE.

     FOUND

     This variable is set to  resulting value after the WAITFOR  statement
     is executed.  It is set to FALSE if time exceeded.  Otherwise, it  is
     set to the string number of the matched string.  For example,

          waitfor "NO CARRIER","thanks for calling","hang up now",100
          switch found
             case 1: print "'NO CARRIER' found"
             case 2: print "'thanks for calling' found"
             case 3: print "'hang up now' found"
          endswitch

     SUCCESS

     This variable is used  by several statements.   The resulting  values
     and descriptions is shown in the following table.

     Statement    Value    Description
     ÄÄÄÄÄÄÄÄÄ    ÄÄÄÄÄ    ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
     Append       TRUE     the file is successfully opened or created
                  FALSE    cannot create file

     Close        TRUE     file closed
                  FALSE    cannot close file

     Create       TRUE     the file is successfully created
                  FALSE    cannot create file

     InputCh ch   TRUE      a character is read into 'ch'
                  FALSE     no character is available

     LogOn        TRUE     the log file is successfully opened
                  FALSE    the log file cannot be created

     Open         TRUE     the file is successfully opened
                  FALSE    the file does not exist

     Read str     TRUE     a line is read into 'str'
                  FALSE    end of file encountered.

     ReadCh ch    TRUE     a character is read into 'ch'
                  FALSE    end of file encountered.

     Receive      TRUE     all files are received successfully
                  FALSE    file transfer aborted

     Send         TRUE     all files are sent successfully
                  FALSE    file transfer aborted

     Write        TRUE     write successary to file
                  FALSE    cannot write to file
     
     TELEMATE SCRIPT                                      EXPRESSIONS    6
     
     
     EXPRESSIONS


     Rule Of Precedence
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Expressions are  made  up of  operators  and operands.    In  complex
     expressions, rule of precedence clarify the order in which operations
     are performed.

          Operators           Precedence
          ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ      ÄÄÄÄÄÄÄÄÄÄÄÄ
          *,/                 first (high)
          +,-                 second
          =,<>,<,>,<=,>=      third
          not                 fourth
          and, or, xor        fifth (low)

     There are the rules of precedence

       1. First, an operand between two operators of difference
          precedence is bound to the operator with higher precedence.
       2. Second, an operand between two equal operators is bound to
          the one on its left.
       3. Third, expressions within parentheses are evaluated prior to
          being treated as a single operand.


     Arithmetic Operators
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The types  of operands  for  arithmetic operators  are shown  in  the
     following table.

          Operators   Operation        Operand Type
          ÄÄÄÄÄÄÄÄÄ   ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ   ÄÄÄÄÄÄÄÄÄÄÄÄ
              +       addition         integer
              -       subtraction      integer
              *       multiplication   integer
              /       division         integer

     For example, the formula to convert Fahrenheit temperature to Celsius
     equivalents is

          celsius = (fahr-32) * 5 / 9


     
     TELEMATE SCRIPT                                      EXPRESSIONS    7
     
     
     Boolean Operators
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The types  of operands  for  arithmetic operators  are shown  in  the
     following table.

          Operators   Operation     Operand Type
          ÄÄÄÄÄÄÄÄÄ   ÄÄÄÄÄÄÄÄÄÄÄ   ÄÄÄÄÄÄÄÄÄÄÄÄ
             not      negation      boolean
             and      logical and   boolean
             or       logical or    boolean
             xor      logical xor   boolean

     Normal Boolean logic governs  the results of  these operations.   For
     instance, 'a and b' is TRUE only if both a an b are TRUE.


     Relational Operators
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The types  of operands  for  arithmetic operators  are shown  in  the
     following table.

          Operators Operation    Operand Types
          ÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
             =      equal to     integer, string
             <>     not equal to integer, string
             >      greater than integer, string
             >=     greater or   integer, string
                    equal to
             <      less then    integer, string
             <=     less then or integer, string
                    equal to

     They all have the  same precedence.   beside comparing integers,  the
     operators can be used to compare strings.  For example,

            Condition         Result   Explanation
       ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ   ÄÄÄÄÄÄ   ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
         "hello" =  "Hello"   TRUE     TMScript is not case sensitive.
       "goodbye" >  "bye"     TRUE     "bye" is a sub-string of "goodbye"
           "dog" <> "car"     TRUE     The string is not equal
           "boy" <= "man"     FALSE    "boy" is not a sub-string of "man"
                                       and they are not equal.

     
     TELEMATE SCRIPT                            STRUCTURED STATEMENTS    8
     
     
     STATEMENTS

     Statements describe algorithmic actions that can be executed.


     Comment
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Any characters after ";" are ignored by the TMScript compiler.


     Assignment Statement
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Assignment statements replace the current value of a variable with  a
     new value  specified  by  an  expression.   The  expression  must  be
     assignment-compatible with the type of the variable.

     The program prints the following table of Fahrenheit temperatures and
     their centigrade or Celsius equivalents.

          0     -17
          20    -6
          40    4
          ...   ...
          280   137
          300   148

     Here is the program itself.

          ; Print Fahrenheit-Celsius table
          ;       for f = 0, 20, ... , 300

          integer LOWER,UPPER,STEP
          integer fahr,celsius

          LOWER = 0       ; lower limit of temperature table
          UPPER = 300     ; upper limit
          STEP  = 20      ; step size

          fahr  = LOWER
          while fahr <= UPPER
             celsius = (fahr-32) * 5 / 9
             print fahr,"^I",celsius
             fahr = fahr + STEP
          endwhile


     If Statement
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The general form for IF statement is

          IF condition
             statements
          ENDIF
     
     TELEMATE SCRIPT                            STRUCTURED STATEMENTS    9
     
     

     The 'statements' is  executed only  if 'condition'  is TRUE.  Another
     form is

          IF condition
             statements-1
          ELSE
             statements-2
          ENDIF

     One and only one of the  two statements associated with an  'if-else'
     is done.  If the 'condition' is true, 'statements-1' is executed;  if
     not, 'statements-2' is executed.

     The construction

          IF condition-1
             statements-1
          ELSE
             IF condition-2
                statements-2
             ELSE
                IF condition-3
                   statements-3
                ENDIF
             ENDIF
          ENDIF

     occurs so often that it is worth a new keyword ELSEIF.  The statement
     can be re-written as

          IF     condition-1
                statements-1
          ELSEIF condition-2
                statements-2
          ELSEIF condition-3
                statements-3
          ENDIF


     Switch Statement
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The SWITCH statement is a special multi-way decision maker that tests
     whether an expression matches one of a number of values, an  branches
     accordingly.  The syntax for SWITCH statement is

          SWITCH expression
            CASE valueÄ1:
               statementsÄ1
            CASE valueÄ2,valueÄ3:
               statementsÄ2
            OTHERWISE:
               statementsÄ3
          ENDSWITCH
     
     TELEMATE SCRIPT                           STRUCTURED STATEMENTS    10
     
     

     The SWITCH evaluates the expression and compares its value to all the
     cases.  Each cases must be labeled by the values of the same type  as
     the expression. Several values can be separated by comma.  If a  case
     matches the expression value, execution starts at that case and  ends
     at the next  case label. The  case labeled OTHERWISE  is executed  if
     none of the other cases is satisfied.  A OTHERWISE is optional; if it
     isn't there and if none of the cases matches, no action at all  takes
     place. However, OTHERWISE, if  exists, must be  placed after all  the
     case labels.

     The program counts digits, blanks, others.

          ndigit = 0          ; digit
          nblank = 0          ; blank
          nother = 0          ; others
          open "FILE"
          readch ch
          while success
             switch ch
               case "0","1","2","3","4","5","7","8","9":
                  ndigit = ndight + 1
               case " ":
                  nblank = nblank + 1
               otherwise:
                  nother = nother + 1
             endswitch
             readch ch
          endwhile
          close
          print ndigit
          print nblank
          print nother


     While Loop
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The WHILE loop is  the most general  loop.  The  syntax of the  WHILE
     loop is

          WHILE condition
              statements
          ENDWHILE

     The 'condition' is tested.  If it is true, the body of the loop  (all
     the statements before  the keyword  ENDWHILE is executed.   Then  the
     condition is re-tested, and if true, the body is executed again. When
     the test becomes false the loop ends, and execution continues at  the
     statements that follows the loop.


     
     TELEMATE SCRIPT                           STRUCTURED STATEMENTS    11
     
     
     Repeat Loop
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     While the WHILE loop test the  condition at the top, the REPEAT  loop
     test it at the bottom.  It tests at the bottom after making each pass
     through the loop  body; the body  is always executed  at least  once.
     Consider the loop

          REPEAT
             statements
          UNTIL condition

     The statements is executed, then the  condition is evaluated.  If  it
     is false,  the statements  is evaluated  again, and  so on.   If  the
     condition becomes true, the loop terminates.


     Exit Statement
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     It is sometimes  convenient to be  able to control  loop exits  other
     than by testing at the top or bottom.  The EXIT statement provides an
     early exit from  the loops.   A EXIT statement  causes the  innermost
     loop to be exited immediately.

     The following program accept strings  from keyboard, using a EXIT  to
     exit from the loop when the string contains an [Esc] ("^[").

          repeat
             input s
             if "^[" <= s     ; test if [Esc] is a sub-string of s
                exit          ;   before printing it
             endif
             print s
          until s = ""        ; repeat until an empty string is entered

     
     TELEMATE SCRIPT                                       PROCEDURE    12
     
     
     PROCEDURE

     In TMScript, a procedure is equivalent to a subroutine or function in
     Fortran, or  procedure in  Pascal, C  etc.   A procedure  provides  a
     convenient way to encapsulate some computation in a black box,  which
     can then be used without  worrying about its innards. Procedures  are
     really the only way  to cope with the  potential complexity of  large
     program.


     Procedure Declaration
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The syntax of a procedure definition is

          PROCEDURE procname
          local declarations part
          statement part
          ENDPROC

     The local declarations made within a given procedure are visible only
     within that procedure.  We should  always include this part in  order
     to make the program easy to  be traced although the declarations  may
     be omitted.


     Scope of Variables
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     TMScript allows  nested procedures;  you  can declare  one  procedure
     inside of another.  For example,

          procedure outer
          string i,j

             procedure inner
             integer i
             i = 100
             print "i = ",i
             print "j = ",j
             endproc

          i = "This is string 'i'."
          j = "This is string 'j'."
          inner
          print "i = ",i
          print "j = ",j
          endproc

     The 'outer' procedure  declares two  string variables,  'i' and  'j'.
     These two variables can be accessed by both the 'outer' procedure and
     the  'inner'  one  because  they  are  declared  before  the  'inner'
     procedure.
     
     TELEMATE SCRIPT                                       PROCEDURE    13
     
     

     The 'inner' procedure declare an integer variable 'i'.  Although  the
     two i's share the same name, they  are not identical.  The inner  'i'
     is visible in the 'inner' procedure but not in the 'outer' procedure.
     On the other hand, the outer 'i'  can no longer be accessible in  the
     'inner' procedure.  The statement

          i = 100

     does not affect the outer 'i'.  This is called the scope rule.

     The output of the program is

          i = 100
          j = This is string 'j'.
          i = This is string 'i'.
          j = This is string 'j'.


     Calling Procedure
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Once the  procedure is  defined,  it can  be  called by  putting  the
     procedure name in the statement part.  In the example, the statement

          inner

     in the 'outer' procedure calls the procedure 'inner'.


     Passing Arguments
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Procedures in TMScript do not accept arguments. The example shows how
     a called procedure can return the value to the calling procedure.

          procedure AddLineFeed
          string ch       ; this MUST not be omitted in this case

             procedure InputChar  ; start of procedure
             repeat
                inputch ch        ; repeat until a character is entered
             until success
             endproc              ; end of procedure

          repeat
             InputChar
             print ch,
             if ch = "^M"         ; if [Enter], add a line feed (Ctrl-J)
                print "^J"
             endif
          until ch = "^["         ; repeat until [Esc] ("^[") is got
          endproc
     
     TELEMATE SCRIPT                                       PROCEDURE    14
     
     

     The global variable  'ch' is  declared before the  definition of  the
     procedure 'InputChar' and, therefore, is accessible by the procedure.
     When the statement

          inputch ch

     is  executed,  the  input  character  is  put  in  the  'ch'  of  the
     'AddLineFeed' procedure.


     Return Statement
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Like the EXIT  statement, it is  sometimes convenient to  be able  to
     return from a procedure at the middle of the procedure.

     The following procedure  accept strings from  keyboard and print  it,
     using a RETURN to return from the procedure when the string  contains
     an [Esc] ("^[").

          procedure AcceptString
          input s
          if "^[" <= s     ; test if [Esc] is a sub-string of s
             Return        ;   before printing it
          endif
          print s
          endproc

     
     TELEMATE SCRIPT                                INPUT AND OUTPUT    15
     
     
     INPUT AND OUTPUT

     Console I/O
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     There are six statements  in the group of  console input and  output.
     Namely,

          Input
          InputCh
          Print
          AT
          Clear Text
          Clear Key


     Input Statement

     A string can be input through the INPUT statement.  After the command

          Input str

     the string  variable 'str'  contains all  characters typed  from  the
     keyboard until [Enter] is pressed.


     InputCh Statement

     A character can be input through the INPUTCH statement.  After

          InputCh ch

     the character  variable  'ch' contains  either  nothing or  the  next
     character of input.  'InputCh' statement, like the INKEY$ function in
     BASIC, does not wait.

     To wait for a character, we should use

          repeat
             InputCh ch
          until success

     The predefined variable SUCCESS has a value of TRUE if a character is
     available.  Otherwise, it has a value of FALSE.


     Print Statement

     Output is simple, the PRINT statement can print variable or  constant
     of types integer or string to the terminal window.  For example,

          print "hello, world"
     
     TELEMATE SCRIPT                                INPUT AND OUTPUT    16
     
     

     print the words

          hello, world

     to the terminal window.

     PRINT supplies  a newline  automatically.   However, if  a comma  ","
     follows the  string, no  newline is  supplied.   The statement  above
     could just as well have been written

          print "hello, ",
          print "world",
          print

     to produce an identical output.  The last PRINT statement supplies  a
     newline.

     PRINT statement accepts more than  one argument.  Each two  arguments
     are separated by a comma.  For example,

          print "x = ",x
          print "My name is ",FirstName," ",LastName
          print


     At Statement

     The AT statement moves the cursor to the position within the terminal
     window.  The upper left corner is (0,0) and the lower right corner is
     (79,24) if a 25 rows terminal is used.  The syntax is

          AT  column,row


     Clear Text Statement

     The CLEAR TEXT statement  clear the text in  the terminal window  and
     set the attribute, or color, to the initial setup.


     Clear Key Statement

     When the INPUT or  INPUTCH statement in the  script is executed,  the
     following input character is placed in a keyboard buffer no matter if
     we want to read  the next key or  not.  As a  result, the   following
     characters are be sent to the remote system automatically. Therefore,
     it is important to give up  the control of keyboard whenever no  more
     keyboard input is  needed and the  CLEAR KEY statement  is built  for
     this purpose.

     The statement also clears the content of the keyboard buffer and  all
     keyboard input before this statement are thrown away.


     
     TELEMATE SCRIPT                                INPUT AND OUTPUT    17
     
     
     COM I/O
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     As a  communication program,  TMScript provides  four I/O  statements
     that communicate with the remote system.  They are

          Get
          GetCh
          Put
          Clear COM

     The first  three statements  are the  same as  those in  console  I/O
     except that they input from or output to the remote system.


     Get Statement

     A string can be input through the GET statement.  After the command

          Get str

     the string variable 'str' contains  all characters received from  the
     remote system until [Enter] is pressed.


     GetCh Statement

     A character can be received through the GETCH statement.  After

          GetCh ch

     the character  variable  'ch' contains  either  nothing or  the  next
     character of input.   GETCH  statement, like the  INKEY$ function  in
     BASIC, does not wait.

     To wait for a character, we should use

          repeat
             GetCh ch
          until success

     The predefined variable SUCCESS has a value of TRUE if a character is
     available.  Otherwise, it has a value of FALSE.

     
     TELEMATE SCRIPT                                INPUT AND OUTPUT    18
     
     
     Put Statement

     COM output is as simple as console output, the PUT statement can send
     variable or constant of types integer or string to the remote system.
     For example,

          put "FIRST LAST"

     send the words

          FIRST LAST

     and a carriage return (Ctrl-M) to the remote system.

     PUT supplies a carriage  return automatically.   However, if a  comma
     "," follows  the  string,  no  carriage  return  is  supplied.    The
     statement above could just as well have been written

          put "FIRST  ",
          put "LAST",
          put

     to produce an identical  output.  The last  PUT statement supplies  a
     carriage return only.

     PUT statement accepts more than one argument.  Each two arguments are
     separated by a comma.  For example,

          put FirstName,";",LastName,";",Password


     Clear COM

     As all data being sent  and received are placed  in a COM buffer,  we
     may sometimes need to clear the buffer.  For example,

          get s      ; get a string
          delay 50   ; wait for 5 seconds
          clear com  ; clear the received data in the last 5 seconds
          get s      ; get another string

     As there  may  be some  un-wanted  data  received in  the  5  seconds
     interval, it  is necessary  to clear  the buffer  before getting  the
     required data.


     
     TELEMATE SCRIPT                                INPUT AND OUTPUT    19
     
     
     File I/O
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     File I/O in TMScript is simple too.  Only one text file is allowed to
     open at a  time.   The file  can be either  read or  write.   Several
     statements are supported.

          Statements              Access
          ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ     ÄÄÄÄÄÄÄÄÄÄ
          Open    filename        read only
          Create  filename        write only
          Append  filename        writ e only
          Read    str             read
          ReadCh  ch              read
          Write   str,int,...     write
          Close

     Open   statement opens a file that already exist.
     Create statement creates a new file.  old file is deleted.
     Append statement opens a file, create it if necessary, and all the
            output appends at the end of the file.
     Close  statement closes the opened file.

     The remaining work the same as those in Console I/O except that  they
     input from or output to file.

     The predefined variable SUCCESS  is set to  the resulting value.  The
     values and descriptions is shown in the following table.

     Statement    Value    Description
     ÄÄÄÄÄÄÄÄÄ    ÄÄÄÄÄ    ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
     Open         TRUE      the file is successfully opened
                  FALSE     the file does not exist

     Create       TRUE     the file is successfully created
                  FALSE    cannot create file

     Append       TRUE     the file is successfully opened or created
                  FALSE    cannot create file

     Read str     TRUE     a line is read into 'str'
                  FALSE    end of file encountered.

     ReadCh ch    TRUE     a character is read into 'ch'
                  FALSE    end of file encountered.

     Write ...    TRUE     write to file successfully
                  FALSE    cannot write to file

     Close        TRUE     file closed
                  FALSE    cannot close file

     
     TELEMATE SCRIPT                                INPUT AND OUTPUT    20
     
     
     The next program counts lines in its input.

          ; count lines in input
          Open "FILE"
          if not success
             print "File not found."
             stop
          endif
          n = 0
          Read str
          while success
             n = n + 1
             Read str
          endwhile
          Close
          if not success
             print "Cannot close file."
             stop
          endif
          print "There are ",n," lines in the file"

     Note: The Read  statement will  discard the CR/LF  sequence from  the
     string.

     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    21
     
     
     BUILT IN FUNCTIONS


     Alarm
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     This statement pop-up the alarm window.  You can specify a message to
     be displayed in the alarm window.  The syntaxes are

          alarm
          alarm message

     where 'message' is a string expression.  Example:

          receive "s"
          if not success
             alarm "Warning: File transfer aborted"
          endif

     If the message is  too long, it  can be splited  to several lines  by
     putting a "^J" between each line.  For example,

          alarm "alarm:^JThis is a^Jvery long message"


     Append
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the File I/O section.


     At
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the Console I/O section.


     Atoi and Itoa
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The ATOI statement  converts a string  to an integer  while the  ITOA
     statement converts an integer to a string.  The syntaxes are

          Atoi  str,int
          Itoa  int,str


     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    22
     
     
     Clear
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the Console I/O section for

          Clear Text
          Clear Key

     and the COM I/O section for

          Clear COM


     Close
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the File I/O section.


     Concat
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The CONCAT statement appends one string to another.

          Statement         Contain of s
          ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ    ÄÄÄÄÄÄÄÄÄÄÄÄ
          s = "abc"         abc
          concat s,"xyz"    abcxyz
          concat s,"^H"     abcxy
          concat s,"pq"     abcxypq

     When the backspace character "^H", is encountered, the last character
     of the string is erased.


     Create
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the File I/O section.


     Date
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The DATE statement returns the system date.

          date d

     'd', the date string in MM-DD-YY format.


     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    23
     
     
     Delay
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The statement does nothing but waits for a specified time.

          delay t

     't', in  tenth  second, is  the  amount of  time  to be  waited.  For
     example, the statement

          delay 15

     wait for one and a half second.


     Dial
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The DIAL statement has two syntaxes

          dial
          dial list

     where 'list'  is a  string expression.  The first  syntax acts  as  a
     redial command; the last dial list  is used.  The second syntax  sets
     the dial list to 'list' and then dial the numbers.

          dial "1 3 6"
          if not connected
             print "Aborted by operator"
             stop
          endif
          switch connected
            case 1: print "connected to #1"
            case 3: print "connected to #3"
            case 6: print "connected to #6"
          endswitch

     The DIAL  statement sets  the CONNECTED  predefined variable  to  the
     number of the connected entry.  If the operator press [Esc] to  abort
     the dialing process, CONNECTED is set to FALSE.

     In addition, the variable CONNECTED returns  to FALSE as soon as  the
     carrier lost.  On the other hand, if the state of the carrier changes
     from Off to On, CONNECTED is set to TRUE.


     Dos
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     This statement executes a command or jumps to DOS.

          Syntax           Description
          ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ  ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
          Dos              Jump to DOS
          Dos command      Execute 'command'
     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    24
     
     
     ExitTelemate
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     This statement terminates Telemate  and return to DOS.   The file  in
     the Edit window is saved automatically if necessary. The syntax is

          ExitTelemate
          ExitTelemate exitCode

     If 'ExitCode' is not specified, Telemate exits to DOS with the  error
     level 0.  Otherwise, the error level is set to 'ExitCode'.


     Get and GetCh
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the COM I/O section.


     HangUp
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The HANGUP statement send the modem  hangup string to the modem.   If
     the modem hangup string is set correctly, this statement hangs up the
     phone.


     Image
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     This statement captures  the terminal screen  to a image  file.   The
     syntaxes are

          Image
          Image filename

     If no 'filename' is supplied, the last image filename is used.


     Input and InputCh
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
     Please refer to the Console I/O section.


     Itoa
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to ATOI statement.


     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    25
     
     
     LogOff and LogOn
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     These statements open or close the log file.  The syntaxes are

          Syntax          Description
          ÄÄÄÄÄÄÄÄÄÄÄÄÄ   ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
          LogOn logfile   open log file 'logfile'
          LogOn           open the log file specified in phone directory
          LogOff          close log file

     If there  is no  log file  specified in  the dialing  directory,  the
     filename "TM.LOG" is used.

     The predefined variable SUCCESS has a value of TRUE if the logfile is
     open successfully by the LogOn command.  Otherwise, it has a value of
     FALSE.  The LogOff command does not change this variable.



     Open
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
     Please refer to the File I/O section.


     Print
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the Console I/O section.


     Put
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the COM I/O section.


     Read and ReadCh
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the File I/O section.


     Receive and Send
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     These statements  send  (upload)  or receive(download)  files.    The
     syntaxes are

          send protocol filenames
          receive protocol filename
          receive protocol

     where 'protocol' is a character that contain one of the protocols

     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    26
     
     
          Character      Protocol        'filename' needed
          ÄÄÄÄÄÄÄÄÄ      ÄÄÄÄÄÄÄÄ        ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
             "Z"         Zmodem                 No
             "S"         SEAlink                No
             "X"         Xmodem                 Yes
             "R"         Relaxed Xmodem         Yes
             "Y"         Ymodem                 Yes
             "B"         Batch Ymodem           No
             "G"         Ymodem-G               No
             "T"         Telink                 No
             "M"         Modem7                 No
             "A"         ASCII                  Yes
             "Q"         CIS Quick B            No

     'filenames' is a list of filenames to be sent, for example,

          "\TM\TM120-1.ARC \TM\TM120-2.ARC"
          "*.ARC \UTIL\*.EXE *.TXT".

     'filename' is the name to be  assigned to the received file and  must
     not contain any '*' or '?'. For example,

          "TM120-1.ARC"
          "\TM\TELEMATE.120"

     When the transfer is terminated,  the predefined variable SUCCESS  is
     set to the result of the transfer.  It is TRUE if the files  transfer
     successfully, FALSE if the transfer is aborted.  Example:

          send "z","a:*.* b:*.*"
          if success
             print "File sent successfully"
          else
             print "File transfer aborted"
             stop
          endif
          set zautodownload,off    ; you must turn it off before you tell
          waitfor "command",10     ; the remote system to send the files,
          put "d z *.zip"          ; otherwise, the system's autodown
          receive "z"              ; procedure will take the control and
                                   ; the RECEIVE command will return a
                                   ; wrong SUCCESS value, after the
          set zautodownload,on     ; transfer, you may turn it back to on
          if success
             print "File received successfully"
          else
             print "Warning: File transfer aborted"
             stop
          endif


     Script
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     This statement executes the script file specified.  The syntax is

     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    27
     
     
          Script filename

     The filename may not contain the extension part of a filename and  it
     is found in the Script directory.  For example, the statement

          Script "HOST"

     executes the HOST.SCR in the Script directory.


     Send
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to RECEIVE statement.

     Set
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     One of Telemate's great strengths is its flexibility.  TMScript gives
     you control over many of tis features.  The syntax is

          set option,value

     where the possible option and value are listed below.

          Option            Value       Description
          ÄÄÄÄÄÄÄÄÄÄÄÄÄ     ÄÄÄÄÄÄÄÄ    ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
          AddLineFeed       On / Off    when On, a line feed is supplied
                                        after a carriage return (Ctrl-M)
                                        is received
          AddReturn         On / Off    when On, a carriage return is
                                        supplied after a line feed is
                                        received
          AlarmSound        0 - 999     in second, amount of time that
                                        the alarm music is to be played
          AlarmTime         0 - 999     in second, amount of time that
                                        the alarm window is to be shown
          AutoWrap          On / Off    when On, character after column 80
                                        is wrapped to the new line.
          Baud            300 - 115200  set baud rate (300,1200,2400,4800,
                                        9600,19200,38400,57600,115200)
          Bell              On / Off    when Off, no bell when Ctrl-G
                                        received
          CharPacing        0 - 99      in tenth second, amount of time
                                        that the Paste or ASCII upload
                                        pause when a character is sent
          Connection     Modem/COmputer set the connection type
          Data               7 / 8      set data bits
          DestBs            On / Off    set destructive backspace
          DialAttempt       0 - 999     the number of attempt that the
                                        dialing process will preform,
                                        0 to dial until connected
          DialList          "..."       set the dial list
          DialPause         0 - 999     in second, amount of time to be
                                        wait between two dials
     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    28
     
     
          DialTime          0 - 999     in second, amount of time to be
                                        wait after a number is dialed
          ExpandBlankLine   On / Off    when On, blank lines are
                                        expanded to lines containing
                                        a space
          ExtendedPacing    0 - 99      in tenth second, amount of time
                                        that the Put command or the macro
                                        keys pause when a character is sent

          GuessFile         On / Off    when On, guessed name is put in
                                        the file selection box
          Incoming          On / Off    set incoming translation
          LinePacing        0 - 99      in tenth second, amount of
                                        time that the Paste function
                                        pause when a Ctrl-M is sent
          LocalEcho         On / Off    when On, characters are
                                        displayed in the terminal
          Music             On / Off    when Off, the music string
                                        is not interpreted
          Outgoing          On / Off    set outgoing translation
          PaceChar          0 - 255     in ASCII, the character to be
                                        wait before pasting each line,
                                        0 to disable this function
          Parity          None/Odd/Even set parity
          Port              1 - 8       set COM port number
          Prefix            1 - 4       set the dialing prefix
          Suffix            1 - 4       set the dialing suffix
          Printer           On / Off    when On, received data is
                                        sent to printer
          RtsCts            On / Off    set RTS/CTS flow control
          Stop               1 / 2      set stop bits
          Terminal  TTY/ANSI/VT102/VT52 set the terminal type
          UsageLog          On / Off    set usage log
          XonXoff           On / Off    set XON/XOFF flow control
                                        is received
          ZAutoDownload     On / Off    when Off, Zmodem does not
                                        download automatically
          ZRecovery         ON / OFF    when Off, Zmodem does not
                                        recover aborted transfer


     Stop
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The STOP  statement  terminates  the script  program  execution.  For
     example, a script program usually stops when an error is encountered.

          open "FILE"
          if not success
             print "File not found."
             Stop
          endif


     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    29
     
     
     Time
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The TIME statement returns the system time.

          time t

     't', the time string in HH:MM:SS 24 hour format.


     Usage
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     This statement puts the  specified string to  the usage file  TM.USE.
     System time and date are added to the beginning of the string.

          Usage usageString

     For example,

          Usage "Switching to Host mode"


     Waitfor
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     It is a  universal command  in all script  languages.   It waits  for
     specified strings from the  remote system in a  specified time.   The
     syntaxes are

          Syntax                    Description
          ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ   ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
          waitfor t                 set the default waiting time
                                    to 't'

          waitfor s1,s2, .. ,sN     wait until any of the strings
                                    matched or the default waiting
                                    time exceeded

          waitfor s1,s2, .. ,sN,t   wait until any of the strings
                                    matched or the time 't' exceeded.

     If the waiting time 't', in second,  is equal to 0, no time  checking
     is performed.  It is common  to put the following statements in  your
     script file.

          waitfor "first",30        ; wait for "first" in 30 seconds
          if not found
             print "Not found."     ; if not found, stop
             stop
          else
             put "my name"          ; else send the first and
          endif                     ;  last names

     The predefined  variable FOUND  is  set to  FALSE if  time  exceeded.
     Otherwise, it is set to the string number of the matched string.
     
     TELEMATE SCRIPT                              BUILT IN FUNCTIONS    30
     
     
          waitfor "NO CARRIER","thanks for calling","hang up now",0
          print "Ending connection"

     This example, usually placed at the  end of a script file, waits  for
     disconnection and print which string is found.  Note the waiting time
     is set  to 0  which means  that it  waits until  one of  the  strings
     matched.


     WaitUntil
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     The WAITUNTIL statement  does nothing  but wait  until the  specified
     time exceeded.

          WaitUntil t

     't', the time string in HH:MM:SS 24 hour format.  For example,

          WaitUntil "23:10:30"

     pause the script execution until 11:10:30pm.


     When
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     This statement is usually  used in the beginning  of the script  file
     and it is active until the end of the script file. The syntax is

          When waitString,responseString

     When the  'waitString'  is  received  from  the  remote  system,  the
     'responseString' is  sent.   The response  string can  be changed  or
     cancel. For example,

          when "Press ENTER","^M"
          when "More [y,n]?","y^M"    ; set response strings
          waitfor "main menu",0       ; wait for "main menu"
          when "Press ENTER",""       ; cancel response string
          when "More [y,n]?","n^M"    ; change response string
          repeat                      ; make the WHEN statements
          until not connected         ; active until disconnected.

     Line 1 and  2 set the  response strings  "^M" and "y^M"  to the  wait
     strings "Press ENTER" and "More  [y,n]?" respectively.  Line 3  waits
     for the string "main  menu".  Line 4  cancel the response string  for
     "Press ENTER".  Line 5 changes the response string for "More  [y,n]?"
     to "n^M".  The REPEAT loop in Line 6 makes the WHEN statements active
     until disconnected.


     Write
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Please refer to the File I/O section.
     
     TELEMATE SCRIPT                APPENDIX A: SUMMARY OF FUNCTIONS    31
     
     
     APPENDIX A: SUMMARY OF FUNCTIONS


     If Statement
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     IF conditionÄ1
          statementsÄ1
     ELSEIF conditionÄ2
          statementsÄ2
     ELSE
          statementsÄ3
     ENDIF


     Switch Statement
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     SWITCH expression
       CASE valueÄ1:
          statementsÄ1
       CASE valueÄ2,valueÄ3:
          statementsÄ2
       OTHERWISE:
          statementsÄ3
     ENDSWITCH


     While Loop
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     WHILE condition
             statements
     ENDWHILE


     Repeat Loop
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     REPEAT
          statements
     UNTIL condition


     Procedure Declaration
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     PROCEDURE procname
     local declaration part
     statement part
     ENDPROC


     
     TELEMATE SCRIPT                APPENDIX A: SUMMARY OF FUNCTIONS    32
     
     
     Console I/O
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Input    str
     InputCh  ch
     Print    str,int, ...
     At       column,row
     Clear    Text
     Clear    Key


     COM I/O
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Get      str
     GetCh    ch
     Put      str,int, ...
     Clear    COM


     File I/O
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Open     filename
     Create   filename
     Append   filename
     Read     str
     ReadCh   ch
     Write    str,int, ...
     Close


     Built in Functions
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     Statement    Arguments
     ÄÄÄÄÄÄÄÄÄ    ÄÄÄÄÄÄÄÄÄ
     Alarm        message
     Atoi         str,int
     Concat       str1,str2
     Date         str
     Delay        t (in tenth second)
     Dial         s1,s2, ... ,sN,t
     Dos          command (optional)
     ExitTelemate int
     HangUp
     Image        filename
     Itoa         int,str
     LogOff
     LogOn        filename (optional)
     Receive      protocol, filename
     Script       filename
     Send         protocol, filenames
     Set          option, value (see the following table)
     Stop
     
     TELEMATE SCRIPT                APPENDIX A: SUMMARY OF FUNCTIONS    33
     
     
     Time         str
     Usage        str
     Waitfor      s1,s2, ... ,sN,t
     WaitUntil    str
     When         s1,s2


     The following shows the options and values of the SET statement.

     Set   option,          value
     ÄÄÄ   ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
     Set   AddLineFeed,     On/Off
     Set   AddReturn,       On/Off
     Set   AlarmSound,      0-999
     Set   AlarmTime,       0-999
     Set   AutoWrap,        On/Off
     Set   Baud,            300-115200
     Set   Bell,            On/Off
     Set   CharPacing,      0-99
     Set   Connection,      MODEM/COMPUTER
     Set   Data,            7/8
     Set   DestBs,          On/Off
     Set   DialAttempt,     0-999
     Set   DialList,        list (optional)
     Set   DialPause,       0-999
     Set   DialTime,        0-999
     Set   ExpandBlankLine, On/Off
     Set   ExtendedPacing,  0-99
     Set   GuessFile,       On/Off
     Set   Incoming,        On/Off
     Set   LinePacing,      0-99
     Set   LocalEcho,       On/Off
     Set   Music,           On/Off
     Set   Outgoing,        On/Off
     Set   PaceChar,        0-255
     Set   Parity,          None/Odd/Even
     Set   Port,            1-8
     Set   Prefix,          1-4
     Set   Suffix,          1-4
     Set   Printer,         On/Off
     Set   RtsCts,          On/Off
     Set   Stop,            1/2
     Set   Terminal,        TTY/ANSI/VT102/VT52
     Set   UsageLog,        On/Off
     Set   XonXoff,         On/Off
     Set   ZAutoDownload,   On/Off
     Set   ZRecovery,       On/Off

     
     TELEMATE SCRIPT                      APPENDIX B: ERROR MESSAGES    34
     
     
     APPENDIX B: ERROR MESSAGES

     Compiler Error Messages
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     "'CASE' expected"

     "Declaration error"

     A symbol is placed in wrong sequence  the declaration part.  You  may
     have forgotten the comma between two variables.

     "'ENDIF' expected"

     "'ENDPROC' expected"

     "'ENDSWITCH' expected"

     "'ENDWHILE' expected"

     "Identifier expected"

     An identifier was expected at this point.  You may be trying to use a
     reserved word as an variable.

     "Invalid expression"

     This symbol cannot participate in an  expression in the way it  does.
     You may have forgotten to write an operator between two operands.

     "Invalid option"

     You have  mistyped the  option  or forgotten  the comma  between  the
     option and the value.

     "Invalid sequence"

     The symbol cannot at a statement.

     "Invalid string operation"

     An arithmetic operator is  applied to string  expression.  To  concat
     two strings, use the 'ConCat' function.

     "Misplacing Exit statement"

     The EXIT can only be  placed in WHILE and  REPEAT loop. You may  have
     put it outside a loop.

     "New line expected"

     Every statement should be in a line.
     
     TELEMATE SCRIPT                      APPENDIX B: ERROR MESSAGES    35
     
     

     "Nested too deep"

     TMScript allows no more than 10 nested procedures.

     "Number out of range"

     Integer must within the range from -2147483648 to 2147483647.

     "Numeric expression expected"

     The preceding expression must be of integer type.

     "Program Incomplete - Unexpected end of file"

     Your source file ends due to  unbalanced begins and ends.  Check  the
     IF statement, SWITCH statement, WHILE loop, REPEAT loop and procedure
     definition.

     "String expression expected"

     The preceding expression must be of string type.

     "String incomplete"

     You have most likely forgotten the ending quote in a string constant.

     "Syntax error"

     An illegal character  was found  in the source  file.   You may  have
     forgotten the quotes around a string constant.

     "Type mismatch"

     This is due to incompatible types of the variable and the  expression
     in an assignment statement  or incompatible types  of operands in  an
     expression.

     "'UNTIL' expected"

     "',' expected"

     "':' expected"

     "')' expected"

     "'=' expected"


     
     TELEMATE SCRIPT                      APPENDIX B: ERROR MESSAGES    36
     
     
     Runtime Error Messages
     ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

     "Division by zero"

     A number is divided by a expression of zero.

     "Invalid format in script file"

     Make sure  the .TMS  file is  a  compiled script  file.   You  should
     compile the script file using TMS.EXE.

     "Out of memory"

     This error  occurs  when TM.EXE  is  run  out of  memory  and  cannot
     allocate enough memory to the script file.

     "Stack overflow"

     This error is  reported on  entry to a  procedure when  there is  not
     enough stack space to allocate the procedure's local variables.

     
     TELEMATE SCRIPT                                           INDEX    37
     
     INDEX


     .SCR file, 1                       D
     .TMS file, 1
                                        Data Type, 2
     A                                  Data, 27, 33
                                        Date, 22, 32
     AddLineFeed, 27, 33                Delay, 23, 32
     AddReturn, 27, 33                  DestBs, 27, 33
     Alarm, 21, 32                      Dial, 23, 32
     AlarmSound, 27, 33                 DialAttempt, 27, 33
     AlarmTime, 27, 33                  DialList, 27, 33
     Append, 5, 19, 21, 32              DialPause, 27, 33
     Arithmetic Operators, 6            DialTime, 28, 33
     AutoWrap, 27, 33                   Dos, 23, 32
     ASCII code, 2
     Assignment, 8                      E
     At, 16, 32
     Atoi, 21, 32                       Else, 8, 31
                                        ElseIf, 9, 31
     B                                  EndIf, 8, 31
                                        EndSwitch, 9, 31
     Baud, 27, 33                       EndWhile, 10, 31
     Bell, 27, 33                       Error Messages, 34
     Boolean, 3                         Exit, 11
     Boolean Operators, 7               ExitTelemate, 24, 32
     Built In Functions, 21, 32         Expand Blank Line, 28, 33
                                        Expression, 6
     C                                  Extend Pacing, 28, 33

     Calling Procedure, 13              F
     Character, 2
     CharPace, 27, 33                   FALSE, 3
     Clear COM, 18, 22, 32              File I/O, 19, 32
     Clear Key, 16, 22, 32              FOUND, 5
     Clear Text, 16, 22, 32
     Close, 9, 22, 32                   G
     COM I/O, 17, 32
     Comment, 8                         Get, 17, 24, 32
     Comparison, 7                      GetCh, 17, 24, 32
     Compile Script, 5                  GuessFile, 28, 33
     Compiler Error Message, 34
     Concat, 22, 32                     H
     CONNECTED, 4
     Connection, 27, 33                 HangUp, 24, 32
     Console I/O, 15
     Control code, 2
     Create, 18, 19, 22, 32

     
     TELEMATE SCRIPT                                           INDEX    38
     
     I

     If, 8, 31                          S
     Image, 24, 32
     Incoming, 28, 33                   Script, 26, 32
     Input, 15, 24, 32                  Scope of Variables, 12
     InputCh, 15, 24, 32                Send, 25, 27, 32
     Integer, 2                         Set, 27, 32, 33
     Itoa, 21, 24, 32                   Statement, 8
                                        Stop, 28, 33
     L                                  String, 2
                                        SUCCESS, 5
     LinePace, 28, 33                   Suffix, 28, 33
     LocalEcho, 28, 33                  Summary, 31
     LogOff, 25, 32                     Switch, 9, 31
     LogOn, 5, 25, 32
                                        T
     M
                                        Terminal, 28, 33
     Music, 28, 33                      Time, 29, 33
                                        TRUE, 5
     O
                                        U
     Open, 19, 25, 32
     Otherwise, 9, 31                   Until, 11, 31
     Outgoing, 28, 33                   Usage, 29, 33
                                        UsageLog, 28, 33
     P                                  Using TMS.EXE, 5

     PaceChar, 28, 33                   V
     Parity, 28, 33
     Passing Argument, 13               Variable Declaration, 4
     Port, 28, 33
     Precedence, 6                      W
     Predefined Variables, 4
     Prefix, 28, 33                     Waitfor, 29, 33
     Print, 16, 25, 32                  WaitUntil, 30, 33
     Printer, 28, 33                    When, 30, 33
     Procedure Declaration, 12, 31      While, 10, 31
     Procedure, 12                      Write, 19, 30, 32
     Protocol, 26
     Put, 18, 25, 32                    X

     R                                  XonXoff, 28, 33

     Read, 19, 25, 32                   Z
     ReadCh, 19, 25, 32
     Receive, 25, 32                    ZAutoDownload, 28, 33
     Relational Operators, 7            ZRecovery, 28, 33
     Repeat, 11, 31
     Return, 14
     RtsCts, 28, 33
     Run Script, 5
     Runtime Error Messages, 36



