home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / termprog / tm301_3.zoo / tmscript.doc < prev   
Encoding:
Text File  |  1992-01-03  |  152.4 KB  |  4,591 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.      ▌███████████ ▌█████████▌  ▌██████                 ▌█             ▌█
  13.           ▌█▌     ▌█▌ ▌█▌ ▌█▌  ▌█▌                                    ▌█
  14.           ▌█▌     ▌█▌ ▌█▌ ▌█▌  ▌█▌      ▌████▌  ▌████  ▌█   ▌██████ ▌█████
  15.           ▌█▌     ▌█▌ ▌█▌ ▌█▌  ▌██████  ▌█      ▌█     ▌█   ▌█   ▌█   ▌█
  16.           ▌█▌     ▌█▌ ▌█▌ ▌█▌       ▌█  ▌█      ▌█     ▌█   ▌█   ▌█   ▌█
  17.           ▌█▌     ▌█▌ ▌█▌ ▌█▌       ▌█  ▌█      ▌█     ▌█   ▌█   ▌█   ▌█
  18.           ▌█▌     ▌█▌ ▌█▌ ▌█▌  ▌██████  ▌████▌  ▌█     ▌█   ▌██████   ▌███
  19.                                                             ▌█
  20.                                                             ▌█
  21.                                                             ▌█
  22.  
  23.  
  24.  
  25.  
  26.                            Telemate Script Language
  27.  
  28.                                  Version 3.01
  29.  
  30.  
  31.  
  32.                       By  Tsung Hu, White River Software
  33.  
  34.  
  35.  
  36.  
  37.  
  38.                  Copyright (c) 1988-1992 White River Software.
  39.  
  40.                               All rights reserved.
  41.  
  42.  
  43.  TELEMATE SCRIPT                                TABLE OF CONTENTS    i
  44.  
  45.  TABLE OF CONTENTS
  46.  
  47.  INTRODUCTION                                                        1
  48.     Using TMS.EXE, the Script Compiler  . . . . . . . . . . . . . .  1
  49.     To Run a Script . . . . . . . . . . . . . . . . . . . . . . . .  1
  50.     Hello, world  . . . . . . . . . . . . . . . . . . . . . . . . .  2
  51.  
  52.  DATA TYPES                                                          3
  53.     Integer . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  54.     String  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  55.     Character . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  56.     Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  57.     Date  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  58.     Time  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  59.  
  60.  VARIABLES                                                           5
  61.     Variable Identifiers. . . . . . . . . . . . . . . . . . . . . .  5
  62.     Variable Declarations . . . . . . . . . . . . . . . . . . . . .  5
  63.     Predefined Variables. . . . . . . . . . . . . . . . . . . . . .  5
  64.        CONNECTED  . . . . . . . . . . . . . . . . . . . . . . . . .  5
  65.        FOUND  . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
  66.        SUCCESS  . . . . . . . . . . . . . . . . . . . . . . . . . .  6
  67.        LOGGING  . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  68.        WIDTH  . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  69.        HEIGHT . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  70.  
  71.  EXPRESSIONS                                                         9
  72.     Rule Of Precedence  . . . . . . . . . . . . . . . . . . . . . .  9
  73.     Arithmetic Operators  . . . . . . . . . . . . . . . . . . . . .  9
  74.     Boolean Operators . . . . . . . . . . . . . . . . . . . . . . .  9
  75.     Relational Operators  . . . . . . . . . . . . . . . . . . . . . 10
  76.  
  77.  STATEMENTS                                                         11
  78.     Comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  79.     Assignment Statement  . . . . . . . . . . . . . . . . . . . . . 11
  80.     If Statement  . . . . . . . . . . . . . . . . . . . . . . . . . 11
  81.     Switch Statement  . . . . . . . . . . . . . . . . . . . . . . . 12
  82.     While Loop  . . . . . . . . . . . . . . . . . . . . . . . . . . 13
  83.     Repeat Loop . . . . . . . . . . . . . . . . . . . . . . . . . . 14
  84.     Exit Statement  . . . . . . . . . . . . . . . . . . . . . . . . 14
  85.     #include Directive  . . . . . . . . . . . . . . . . . . . . . . 14
  86.  
  87.  PROCEDURES                                                         16
  88.     Procedure Declaration . . . . . . . . . . . . . . . . . . . . . 16
  89.     Parameter Declaration . . . . . . . . . . . . . . . . . . . . . 17
  90.     Calling Procedure and Parameter Passing . . . . . . . . . . . . 17
  91.     Nested Procedures and Scope of Variables  . . . . . . . . . . . 18
  92.     Return Statement  . . . . . . . . . . . . . . . . . . . . . . . 19
  93.  
  94.  BUILT IN PROCEDURES BY CATEGORY                                    20
  95.     Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . 20
  96.        Print Statement  . . . . . . . . . . . . . . . . . . . . . . 20
  97.     COM I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
  98.        Put Statement  . . . . . . . . . . . . . . . . . . . . . . . 21
  99.        Waitfor Statement  . . . . . . . . . . . . . . . . . . . . . 21
  100.     File Handling   . . . . . . . . . . . . . . . . . . . . . . . . 22
  101.     String Handling . . . . . . . . . . . . . . . . . . . . . . . . 22
  102.  
  103.  TELEMATE SCRIPT                               TABLE OF CONTENTS    ii
  104.  
  105.  
  106.     Miscellaneous Routines  . . . . . . . . . . . . . . . . . . . . 22
  107.  
  108.  BUILT IN PROCEDURES                                                23
  109.     Alarm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
  110.     Append  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
  111.     At  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
  112.     Atoi  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
  113.     ChDir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
  114.     Clear COM . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
  115.     Clear Key . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
  116.     Clear Text  . . . . . . . . . . . . . . . . . . . . . . . . . . 25
  117.     Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
  118.     ComInCount  . . . . . . . . . . . . . . . . . . . . . . . . . . 26
  119.     ComOutCount . . . . . . . . . . . . . . . . . . . . . . . . . . 26
  120.     Concat  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
  121.     Create  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
  122.     Date  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
  123.     Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
  124.     Delete  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
  125.     Dial  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
  126.     Dos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
  127.     ExitTelemate  . . . . . . . . . . . . . . . . . . . . . . . . . 30
  128.     FileExist . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
  129.     FileSize  . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
  130.     Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
  131.     GetCh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
  132.     HangUp  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  133.     Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  134.     Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  135.     InputCh . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  136.     Itoa  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  137.     Keystroke . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  138.     Length  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  139.     LoadFon . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  140.     LoadKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
  141.     LoadMac . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
  142.     LoadPad . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
  143.     LogOff  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
  144.     LogOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
  145.     LogPause  . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  146.     LogResume . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  147.     Open  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  148.     Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
  149.     Put . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
  150.     Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
  151.     Read  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
  152.     ReadCh  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
  153.     Receive . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
  154.     Rename  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
  155.     Script  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
  156.     Seek  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
  157.     Send  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
  158.     Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
  159.     Stop  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
  160.     StrDel  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
  161.     StrIns  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
  162.  
  163.  TELEMATE SCRIPT                              TABLE OF CONTENTS    iii
  164.  
  165.  
  166.     StrPos  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
  167.     StrSet  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
  168.     SubStr  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
  169.     Tell  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
  170.     Time  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
  171.     Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
  172.     Waitfor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
  173.     WaitUntil . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
  174.     When  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
  175.     WhenIdle  . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
  176.     WhereX  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
  177.     WhereY  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
  178.     Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
  179.  
  180.  TOOLBOX PROCEDURES                                                 57
  181.     Toolbox #1                                                      57
  182.        Color Values and ANSI Color Codes  . . . . . . . . . . . . . 57
  183.        EchoToLocal and EchoToRemote   . . . . . . . . . . . . . . . 58
  184.        Echo and EchoInt . . . . . . . . . . . . . . . . . . . . . . 58
  185.        EchoBkColor  . . . . . . . . . . . . . . . . . . . . . . . . 59
  186.        EchoBlink  . . . . . . . . . . . . . . . . . . . . . . . . . 59
  187.        EchoBlock  . . . . . . . . . . . . . . . . . . . . . . . . . 60
  188.        EchoBox  . . . . . . . . . . . . . . . . . . . . . . . . . . 60
  189.        EchoClearScreen  . . . . . . . . . . . . . . . . . . . . . . 61
  190.        EchoColor  . . . . . . . . . . . . . . . . . . . . . . . . . 61
  191.        EchoGotoXY . . . . . . . . . . . . . . . . . . . . . . . . . 62
  192.        EchoHiLite . . . . . . . . . . . . . . . . . . . . . . . . . 62
  193.        EchoNormal . . . . . . . . . . . . . . . . . . . . . . . . . 62
  194.        EchoReverse  . . . . . . . . . . . . . . . . . . . . . . . . 63
  195.     Toolbox #2                                                      63
  196.        GetN . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
  197.        InputN . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
  198.        ReadN  . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
  199.        isalpha  . . . . . . . . . . . . . . . . . . . . . . . . . . 65
  200.        isalnum  . . . . . . . . . . . . . . . . . . . . . . . . . . 65
  201.        iscntl . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
  202.        isdigit  . . . . . . . . . . . . . . . . . . . . . . . . . . 66
  203.     Toolbox #3                                                      66
  204.        ConvertDate  . . . . . . . . . . . . . . . . . . . . . . . . 66
  205.        DiffDate . . . . . . . . . . . . . . . . . . . . . . . . . . 67
  206.        DiffTime . . . . . . . . . . . . . . . . . . . . . . . . . . 67
  207.        PhoneDirectory . . . . . . . . . . . . . . . . . . . . . . . 68
  208.        PhoneFind  . . . . . . . . . . . . . . . . . . . . . . . . . 68
  209.        PhoneRead  . . . . . . . . . . . . . . . . . . . . . . . . . 69
  210.        PhoneSize  . . . . . . . . . . . . . . . . . . . . . . . . . 70
  211.        PhoneWrite . . . . . . . . . . . . . . . . . . . . . . . . . 70
  212.  
  213.  APPENDIX A: ERROR MESSAGES                                         72
  214.     Compiler Error Messages . . . . . . . . . . . . . . . . . . . . 72
  215.     Runtime Error Messages  . . . . . . . . . . . . . . . . . . . . 74
  216.  
  217.  INDEX                                                              75
  218.  
  219.  
  220.  TELEMATE SCRIPT                                     INTRODUCTION    1
  221.  
  222.  
  223.  INTRODUCTION
  224.  
  225.  TMScript  allows  you  to  write  procedures  to  perform  repetitive
  226.  functions, such as a log on script, as well as specific applications,
  227.  such as the host mode.
  228.  
  229.  TMScript is designed  to be  a easy-to-use  language. TMScript  looks
  230.  similar to the Pascal language and the syntax is as loose as that  of
  231.  BASIC language. For  most of  the users,  only the  WAITFOR, PUT  and
  232.  maybe the WHEN  statements are  necessary. For those  users who  have
  233.  experience in the other programming language, TMScript is a  powerful
  234.  tool for communication related application.
  235.  
  236.  A script file  can be created  using almost all  editors. The  source
  237.  file is  a  normal ASCII  text  file  which contains  a  sequence  of
  238.  instructions telling Telemate what to  perform next. The source  file
  239.  should use the extension .SCR to indicate that it is a SCRipt file.
  240.  
  241.  
  242.  Using TMS.EXE, the Script Compiler
  243.  ─────────────────────────────────────────────────────────────────────
  244.  
  245.  Once the source file is written, it must be compiled (translated)  to
  246.  a form that  Telemate can load  and interpret quickly.  To compile  a
  247.  source file, type
  248.  
  249.       TMS filename
  250.  
  251.  where <filename> is the  filename of the  source file. The  extension
  252.  can  be  omitted   if  it   is  .SCR.  TMS.EXE   compiles  the   file
  253.  'filename.SCR' and produces the compiled script file  'filename.TMS'.
  254.  For example, typing 'TMS  \TM\HOST', TMS compiles '\TM\HOST.SCR'  and
  255.  produces '\TM\HOST.TMS'.
  256.  
  257.  If a syntax  error is encountered  in the source  file, the  compiler
  258.  reports the line number  and the type of  the error. You should  edit
  259.  the source file and recompile until there is no more errors.
  260.  
  261.  
  262.  To Run a Script
  263.  ─────────────────────────────────────────────────────────────────────
  264.  
  265.  There are several ways to run a script.
  266.  
  267.  1. Pressing [Alt S] at the Terminal Window opens the File Dialog and
  268.     you are asked to identify which script file to be executed.
  269.  
  270.  2. Put the script name in the link-script field of the phone
  271.     directory. When the BBS is connected, the link-script is executed
  272.     automatically. Link-scripts are sometimes referred as logon-
  273.     scripts because they perform repetitive logon procedure.
  274.  
  275.  3. Type 'TM <scriptname>' at the DOS command line. For example,
  276.       C>TM HOST
  277.     put Telemate in host mode when start.
  278.  
  279.  
  280.  TELEMATE SCRIPT                                     INTRODUCTION    2
  281.  
  282.  
  283.  4. You may assign a function key to execute a script file using the
  284.     "^\" macro sequence. For example, the function key [Alt 4] is
  285.     "^\host", when you press [Alt 4], the host script will be
  286.     executed.
  287.  
  288.  5. The SCRIPT statement allows you run another script in a script
  289.     program. Please refer the description of the SCRIPT statement.
  290.  
  291.  
  292.  Hello, world
  293.  ─────────────────────────────────────────────────────────────────────
  294.  
  295.  The first program to write is  the same for all languages. Print  the
  296.  words
  297.  
  298.       hello, world
  299.  
  300.  In TMScript, it can be done in one statement:
  301.  
  302.       print "hello, world"        ; print it to terminal screen
  303.  
  304.  If you would  like to say  hello to  the remote system,  use the  PUT
  305.  statement instead, for example,
  306.  
  307.       put "hello, world"          ; send it to remote system
  308.  
  309.  
  310.  TELEMATE SCRIPT                                       DATA TYPES    3
  311.  
  312.  
  313.  DATA TYPES
  314.  
  315.  TMScript provides two basic data types, integer and string, and  four
  316.  extended data types, character, boolean, date and time.
  317.  
  318.  
  319.  Integer
  320.  ─────────────────────────────────────────────────────────────────────
  321.  
  322.  Ordinary  number  notation   is  used  for   integers.  Decimal   and
  323.  engineering notation  (e  or  E  followed  by  an  exponent)  is  not
  324.  supported.  Integer  must  within  the  range  from  -2147483648   to
  325.  2147483647.
  326.  
  327.  
  328.  String
  329.  ─────────────────────────────────────────────────────────────────────
  330.  
  331.  A string is a sequence of zero or more characters from extended ASCII
  332.  character set (0-255),  enclosed by  quotation marks.  A string  with
  333.  nothing in  it is  called a  empty string.  Two sequential  quotation
  334.  marks in a string denote a single character, an quotation mark.
  335.  
  336.  TMScript allows control characters to be embedded in strings. The '^'
  337.  character followed  by a  letter (A-Z,  a-z), '@'  or '['  denotes  a
  338.  character of  the ASCII  code [Ctrl  A]  to [Ctrl  Z], NULL,  or  ESC
  339.  respective.
  340.  
  341.  Here are some examples of strings
  342.  
  343.       "TELEMATE"
  344.       "This is a '""'."
  345.       "^K^D"              ; [Ctrl K] [Ctrl D]
  346.  
  347.  
  348.  Character
  349.  ─────────────────────────────────────────────────────────────────────
  350.  
  351.  Character  is  represented  as  a  string  that  contains  only   one
  352.  character. For example, "A" is  a character. Control codes are  often
  353.  used in script programs and are represented as
  354.  
  355.       Code   String Description
  356.       ────── ────── ───────────────
  357.       Ctrl-@  "^@"  NULL
  358.       Ctrl-A  "^A"
  359.        ...     ..
  360.       Ctrl-H  "^H"  Backspace
  361.       Ctrl-I  "^I"  TAB
  362.       Ctrl-J  "^J"  LF, line feed
  363.        ...     ..
  364.       Ctrl-M  "^M"  CR, Carriage Return, [Enter]
  365.        ...     ..
  366.       Ctrl-Z  "^Z"
  367.       Ctrl-[  "^["  Escape
  368.  
  369.  
  370.  TELEMATE SCRIPT                                       DATA TYPES    4
  371.  
  372.  
  373.  Boolean
  374.  ─────────────────────────────────────────────────────────────────────
  375.  
  376.  Boolean (TRUE or  FALSE) is represented  as a integer.  A integer  is
  377.  said to be TRUE if it is not  equal to zero, FALSE if it is equal  to
  378.  zero. When  testing  a boolean  condition,  you should  not  use  the
  379.  following code,
  380.  
  381.       if connected=1
  382.          ...
  383.       endif
  384.  
  385.  because the variable  CONNECTED may have  other values. Instead,  you
  386.  should use
  387.  
  388.       if connected
  389.          ...
  390.       endif
  391.  
  392.  to test if CONNECTED is TRUE. And
  393.  
  394.       if not connected
  395.          ...
  396.       endif
  397.  
  398.  to test if CONNECTED is FALSE.
  399.  
  400.  Date
  401.  ─────────────────────────────────────────────────────────────────────
  402.  
  403.  Date is represented as  a string with the  format "MM-DD-YY". When  a
  404.  date string  is compared  with another  date string,  they are  first
  405.  converted to  the internal  format "YYMMDD"  so that  the  comparison
  406.  returns the correct result.
  407.  
  408.  Note that the date format option in the main program does not  affect
  409.  the format  in  the  script. For  date  conversion,  see  ConvertDate
  410.  command in toolbox #3.
  411.  
  412.  Time
  413.  ─────────────────────────────────────────────────────────────────────
  414.  
  415.  Time is also represented as a string but with the format  "HH:MM:SS".
  416.  When two time strings are being  compared, they are converted to  the
  417.  internal format "HHMMSS"  such that  the comparison  can the  correct
  418.  result.
  419.  
  420.  
  421.  
  422.  TELEMATE SCRIPT                                        VARIABLES    5
  423.  
  424.  
  425.  VARIABLES
  426.  
  427.  
  428.  Variable Identifiers
  429.  ─────────────────────────────────────────────────────────────────────
  430.  
  431.  A variable  identifier can  contain letters  and digits.  However,  a
  432.  variable can only start  with a letter. Case  is not significant,  in
  433.  the other word, the  variable <notdone> is the  same as <NotDone>.  A
  434.  variable identifier  can be  of  any length,  but  only the  first  8
  435.  characters are significant.   For examples,  the variable  identifier
  436.  <Number12> is the same as <Number123>.
  437.  
  438.  
  439.  Variable Declarations
  440.  ─────────────────────────────────────────────────────────────────────
  441.  
  442.  A variable declaration embodies a list of identifiers that  designate
  443.  new variables and their type. For example,
  444.  
  445.       integer LOWER,UPPER,STEP    ; integers
  446.       string  message,filename    ; strings
  447.       integer TRUE,FALSE          ; boolean
  448.       string  ch,letter           ; character
  449.  
  450.  The variable declaration part should be placed at the beginning of  a
  451.  script or of a  procedure. In TMScript,  variables need not  declared
  452.  before use  if  no  procedure is  defined.  Therefore,  the  variable
  453.  declaration part can be skipped.
  454.  
  455.  
  456.  Predefined Variables
  457.  ─────────────────────────────────────────────────────────────────────
  458.  
  459.  TMScript built in procedures do not return value. Several  predefined
  460.  variables are set to the resulting value. They are CONNECTED,  FOUND,
  461.  SUCCESS, LOGGING, WIDTH and HEIGHT.
  462.  
  463.  CONNECTED
  464.  
  465.  CONNECTED is set  to the  number of the  connected entry  (from 1  to
  466.  1000). The variable CONNECTED returns to FALSE as soon as the carrier
  467.  lost. On the other hand, if the state of the carrier changes from OFF
  468.  to ON, CONNECTED is set to TRUE.
  469.  
  470.       if not connected
  471.          print "It is not connected to a remote system."
  472.          stop
  473.       endif
  474.       switch connected
  475.         case 1: print "connected to #1"
  476.         case 3: print "connected to #3"
  477.         case 6: print "connected to #6"
  478.       endswitch
  479.  
  480.  
  481.  TELEMATE SCRIPT                                        VARIABLES    6
  482.  
  483.  
  484.  The CONNECTED  variable is  also used  in conjunction  with the  DIAL
  485.  statement. If  the dialing  is  successful and  connect to  a  remote
  486.  system, the variable is set to the number of the connected entry.  If
  487.  the DIAL statement aborts without connection, the variable  CONNECTED
  488.  is set to  FALSE, indicating that  the DIAL statement  is aborted  by
  489.  operator or the number of  attempt exceeds the dial attempt  setting.
  490.  For example,
  491.  
  492.       dial "1 3 6"
  493.       if not connected
  494.          print "Dialing process aborted"
  495.          stop
  496.       endif
  497.       switch connected
  498.         case 1: print "connected to #1"
  499.         case 3: print "connected to #3"
  500.         case 6: print "connected to #6"
  501.       endswitch
  502.  
  503.  Note that this variable reflects the online status only if your modem
  504.  reports so. You  should check your  modem manual to  ensure that  the
  505.  modem CD  (carrier detect)  signal is  reflecting the  actual  online
  506.  status. Most modems use a "&C1" AT  command to set it and you  should
  507.  add it to the modem init string.
  508.  
  509.  
  510.  FOUND
  511.  
  512.  This variable is set to  resulting value after the WAITFOR  statement
  513.  is executed. It is  set to FALSE if  time exceeded. Otherwise, it  is
  514.  set to the string number of the matched string. For example,
  515.  
  516.       waitfor "NO CARRIER","thanks for calling","hang up now",100
  517.       switch found
  518.          case 1: print "'NO CARRIER' found"
  519.          case 2: print "'thanks for calling' found"
  520.          case 3: print "'hang up now' found"
  521.       endswitch
  522.  
  523.  SUCCESS
  524.  
  525.  This variable is used by several statements. The resulting values and
  526.  descriptions is shown in the following table.
  527.  
  528.  Statement    Value    Description
  529.  ─────────    ─────    ──────────────────────────────────────────
  530.  Append       TRUE     the file is successfully opened or created
  531.               FALSE    cannot create file
  532.  
  533.  ChDir        TRUE     directory changed
  534.               FALSE    invalid path
  535.  
  536.  Close        TRUE     file closed
  537.               FALSE    cannot close file
  538.  
  539.  
  540.  TELEMATE SCRIPT                                        VARIABLES    7
  541.  
  542.  
  543.  Create       TRUE     the file is successfully created
  544.               FALSE    cannot create file
  545.  
  546.  Delete       TRUE     the file is successfully deleted
  547.               FALSE    cannot delete file
  548.  
  549.  FileSize     TRUE     the file size is determined successfully
  550.               FALSE    cannot open file
  551.  
  552.  InputCh ch   TRUE     a character is read into <ch>
  553.               FALSE    no character is available
  554.  
  555.  LoadFon      TRUE     the phone directory is successfully opened
  556.               FALSE    the phone directory cannot be opened
  557.  
  558.  LoadKey      TRUE     the keyboard file is successfully opened
  559.               FALSE    the keyboard file cannot be opened
  560.  
  561.  LoadMac      TRUE     the macro table is successfully opened
  562.               FALSE    the macro table cannot be opened
  563.  
  564.  LoadPad      TRUE     the keypad table is successfully opened
  565.               FALSE    the keypad table cannot be opened
  566.  
  567.  LogOn        TRUE     the log file is successfully opened
  568.               FALSE    the log file cannot be created
  569.  
  570.  Open         TRUE     the file is successfully opened
  571.               FALSE    the file does not exist
  572.  
  573.  Read str     TRUE     a line is read into <str>
  574.               FALSE    end of file encountered.
  575.  
  576.  ReadCh ch    TRUE     a character is read into <ch>
  577.               FALSE    end of file encountered.
  578.  
  579.  Receive      TRUE     all files are received successfully
  580.               FALSE    file transfer aborted
  581.  
  582.  Rename       TRUE     the file is successfully renamed
  583.               FALSE    cannot rename file
  584.  
  585.  Seek         TRUE     the file pointer is moved successfully
  586.               FALSE    disk error
  587.  
  588.  Send         TRUE     all files are sent successfully
  589.               FALSE    file transfer aborted
  590.  
  591.  Tell pos     TRUE     the file pointer is stored in <pos>
  592.               FALSE    disk error
  593.  
  594.  Write        TRUE     write successary to file
  595.               FALSE    cannot write to file
  596.  
  597.  
  598.  TELEMATE SCRIPT                                        VARIABLES    8
  599.  
  600.  
  601.  LOGGING
  602.  
  603.  This variable reflects the current file log status and has the values
  604.  
  605.       0   log file close or log file not in use
  606.       1   log file open and capturing incoming data
  607.       2   log file in pause state
  608.  
  609.  
  610.  WIDTH
  611.  
  612.  This variable stored the width of the zoomed terminal window which is
  613.  equal to the screen width. Possible values are 80 or 132.
  614.  
  615.  
  616.  HEIGHT
  617.  
  618.  This variable is the  height of the zoomed  terminal window which  is
  619.  calculated as
  620.  
  621.       HEIGHT = screen height
  622.       if ( menu bar present )
  623.               HEIGHT = HEIGHT - 1
  624.       if ( status line present )
  625.               HEIGHT = HEIGHT - 1
  626.       if ( HEIGHT < 24 )
  627.               HEIGHT = 24
  628.  
  629.  For example,  on EGA  43 line  mode  with both  menu bar  and  status
  630.  present, HEIGHT is equal to 41. But on 25 line mode, HEIGHT is  equal
  631.  to 24, not  23, because  Telemate's terminal  has at  least 24  lines
  632.  though only 23 lines may be  shown on screen. In this case,  terminal
  633.  will shift up and down to justify the display region.
  634.  
  635.  This variable may alter between  two instructions if the users  press
  636.  [Alt -]   to toggle the  menu bar and  status line. When  programming
  637.  full screen procedure, you  should assume there are  23 lines in  the
  638.  screen and DO NOT  scroll the screen  by going to  the last line  and
  639.  perform a line feed.
  640.  
  641.  
  642.  
  643.  TELEMATE SCRIPT                                      EXPRESSIONS    9
  644.  
  645.  
  646.  EXPRESSIONS
  647.  
  648.  
  649.  Rule Of Precedence
  650.  ─────────────────────────────────────────────────────────────────────
  651.  
  652.  Expressions are  made  up  of  operators  and  operands.  In  complex
  653.  expressions, rule of precedence clarify the order in which operations
  654.  are performed.
  655.  
  656.       Operators           Precedence
  657.       ──────────────      ────────────
  658.       *,/                 first (high)
  659.       +,-                 second
  660.       =,<>,<,>,<=,>=      third
  661.       not                 fourth
  662.       and, or, xor        fifth (low)
  663.  
  664.  There are the rules of precedence
  665.  
  666.    1. First, an operand between two operators of difference
  667.       precedence is bound to the operator with higher precedence.
  668.    2. Second, an operand between two equal operators is bound to
  669.       the one on its left.
  670.    3. Third, expressions within parentheses are evaluated prior to
  671.       being treated as a single operand.
  672.  
  673.  
  674.  Arithmetic Operators
  675.  ─────────────────────────────────────────────────────────────────────
  676.  
  677.  The types  of operands  for  arithmetic operators  are shown  in  the
  678.  following table.
  679.  
  680.       Operators   Operation        Operand Type
  681.       ─────────   ──────────────   ────────────
  682.           +       addition         integer
  683.           -       subtraction      integer
  684.           *       multiplication   integer
  685.           /       division         integer
  686.  
  687.  For example, the formula to convert Fahrenheit temperature to Celsius
  688.  equivalents is
  689.  
  690.       celsius = (fahr-32) * 5 / 9
  691.  
  692.  
  693.  Boolean Operators
  694.  ─────────────────────────────────────────────────────────────────────
  695.  
  696.  The types  of operands  for  arithmetic operators  are shown  in  the
  697.  following table.
  698.  
  699.  
  700.  TELEMATE SCRIPT                                     EXPRESSIONS    10
  701.  
  702.  
  703.       Operators   Operation     Operand Type
  704.       ─────────   ───────────   ────────────
  705.          not      negation      boolean
  706.          and      logical and   boolean
  707.          or       logical or    boolean
  708.          xor      logical xor   boolean
  709.  
  710.  Normal Boolean logic  governs the  results of  these operations.  For
  711.  instance, 'a and b' is TRUE only if both <a> an <b> are TRUE.
  712.  
  713.  
  714.  Relational Operators
  715.  ─────────────────────────────────────────────────────────────────────
  716.  
  717.  The types  of operands  for  arithmetic operators  are shown  in  the
  718.  following table. They all have the same precedence.
  719.  
  720.       Operators Operation    Operand Types
  721.       ───────── ──────────── ───────────────────────────
  722.          =      equal to     integer, string, date, time
  723.          <>     not equal to integer, string, date, time
  724.          >      greater than integer, string, date, time
  725.          >=     greater or   integer, string, date, time
  726.                 equal to
  727.          <      less then    integer, string, date, time
  728.          <=     less then or integer, string, date, time
  729.                 equal to
  730.  
  731.  When the  operands are  integer, date  or time,  the comparison  will
  732.  produce the usual result such as
  733.  
  734.          Condition          Result   Operands Type
  735.   ───────────────────────   ──────   ─────────────
  736.            1 > 2            FALSE    integer
  737.   "12-31-89" < "01-01-90"   TRUE     date
  738.   "00:00:00" > "23:59:59"   FALSE    time
  739.  
  740.  However, if the operands are strings, the operators "<", ">" and "<>"
  741.  have another meaning  such that you  can determine if  a string is  a
  742.  sub-string of another string.
  743.  
  744.      s1 <  s2    if   s1 is a sub-string of s2
  745.      s3 >  s4    if   s3 is a super-string of s4
  746.      s5 <> s6    if   s5 is not a sub-string of s6 and
  747.                       s5 is not a super-string of s6
  748.  
  749.  For example,
  750.  
  751.         Condition         Result   Explanation
  752.    ────────────────────   ──────   ──────────────────────────────────
  753.      "hello" =  "Hello"   TRUE     TMScript is not case sensitive.
  754.    "goodbye" <  "bye"     TRUE     "bye" is a sub-string of "goodbye"
  755.        "dog" <> "car"     TRUE     The string is not equal
  756.        "abc" >= "xyz"     FALSE    "abc" is not a super-string of
  757.                                    "xyz" and they are not equal.
  758.  
  759.  
  760.  TELEMATE SCRIPT                           STRUCTURED STATEMENTS    11
  761.  
  762.  
  763.  STATEMENTS
  764.  
  765.  Statements describe algorithmic actions that can be executed.
  766.  
  767.  
  768.  Comment
  769.  ─────────────────────────────────────────────────────────────────────
  770.  
  771.  Any characters after ";" are ignored by the TMScript compiler.
  772.  
  773.  
  774.  Assignment Statement
  775.  ─────────────────────────────────────────────────────────────────────
  776.  
  777.  Assignment statements replace the current value of a variable with  a
  778.  new  value  specified  by  an  expression.  The  expression  must  be
  779.  assignment-compatible with the type of the variable.
  780.  
  781.  The program prints the following table of Fahrenheit temperatures and
  782.  their centigrade or Celsius equivalents.
  783.  
  784.       0     -17
  785.       20    -6
  786.       40    4
  787.       ...   ...
  788.       280   137
  789.       300   148
  790.  
  791.  Here is the program itself.
  792.  
  793.       ; Print Fahrenheit-Celsius table
  794.       ;       for f = 0, 20, ... , 300
  795.  
  796.       integer LOWER,UPPER,STEP
  797.       integer fahr,celsius
  798.  
  799.       LOWER = 0       ; lower limit of temperature table
  800.       UPPER = 300     ; upper limit
  801.       STEP  = 20      ; step size
  802.  
  803.       fahr  = LOWER                    ; first item in the table
  804.       while fahr <= UPPER
  805.          celsius = (fahr-32) * 5 / 9   ; calcuate the values
  806.          print fahr,"^I",celsius       ; print the result
  807.          fahr = fahr + STEP            ; next item in the table
  808.       endwhile
  809.  
  810.  
  811.  If Statement
  812.  ─────────────────────────────────────────────────────────────────────
  813.  
  814.  The general form for IF statement is
  815.  
  816.       IF condition
  817.          statements
  818.       ENDIF
  819.  
  820.  TELEMATE SCRIPT                           STRUCTURED STATEMENTS    12
  821.  
  822.  
  823.  The <statements> is  executed only  if <condition>  is TRUE.  Another
  824.  form is
  825.  
  826.       IF condition
  827.          statements-1
  828.       ELSE
  829.          statements-2
  830.       ENDIF
  831.  
  832.  One and only one of the  two statements associated with an  <if-else>
  833.  is done. If the <condition>  is true, <statements-1> is executed;  if
  834.  not, <statements-2> is executed.
  835.  
  836.  The construction
  837.  
  838.       IF condition-1
  839.          statements-1
  840.       ELSE
  841.          IF condition-2
  842.             statements-2
  843.          ELSE
  844.             IF condition-3
  845.                statements-3
  846.             ENDIF
  847.          ENDIF
  848.       ENDIF
  849.  
  850.  occurs so often that it is worth a new keyword ELSEIF. The  statement
  851.  can be re-written as
  852.  
  853.       IF     condition-1
  854.             statements-1
  855.       ELSEIF condition-2
  856.             statements-2
  857.       ELSEIF condition-3
  858.             statements-3
  859.       ENDIF
  860.  
  861.  
  862.  Switch Statement
  863.  ─────────────────────────────────────────────────────────────────────
  864.  
  865.  The SWITCH statement is a special multi-way decision maker that tests
  866.  whether an expression matches one of a number of values, an  branches
  867.  accordingly. The syntax for SWITCH statement is
  868.  
  869.       SWITCH expression
  870.         CASE value-1:
  871.            statements-1
  872.         CASE value-2,value-3:
  873.            statements-2
  874.         OTHERWISE:
  875.            statements-3
  876.       ENDSWITCH
  877.  
  878.  
  879.  TELEMATE SCRIPT                           STRUCTURED STATEMENTS    13
  880.  
  881.  
  882.  The SWITCH evaluates the expression and compares its value to all the
  883.  cases. Each cases must be labeled by  the values of the same type  as
  884.  the expression. Several values can be  separated by comma. If a  case
  885.  matches the expression value, execution starts at that case and  ends
  886.  at the next  case label. The  case labeled OTHERWISE  is executed  if
  887.  none of the other cases is satisfied. A OTHERWISE is optional; if  it
  888.  isn't there and if none of the cases matches, no action at all  takes
  889.  place. However, OTHERWISE, if  exists, must be  placed after all  the
  890.  case labels.
  891.  
  892.  The program counts digits, blanks, others.
  893.  
  894.       nDigit = 0          ; digit
  895.       nBlank = 0          ; blank
  896.       nOther = 0          ; others
  897.       open "MYFILE"       ; open the file "MYFILE"
  898.       readch ch           ; read the first character
  899.       while success       ; if not end of file
  900.          switch ch
  901.            case "0","1","2","3","4","5","7","8","9":  ; is digit
  902.               nDigit = nDight + 1
  903.            case " ":                                  ; is blank
  904.               nBlank = nBlank + 1
  905.            otherwise:                                 ; others
  906.               nOther = nOther + 1
  907.          endswitch
  908.          readch ch        ; read next character
  909.       endwhile
  910.       close               ; close the file
  911.       print nDigit        ; print the results
  912.       print nBlank
  913.       print nOther
  914.  
  915.  
  916.  While Loop
  917.  ─────────────────────────────────────────────────────────────────────
  918.  
  919.  The WHILE loop is the most general loop. The syntax is
  920.  
  921.       WHILE condition
  922.          statements
  923.       ENDWHILE
  924.  
  925.  The <condition> is tested. If it is  true, the body of the loop  (all
  926.  the statements  before the  keyword ENDWHILE  is executed.  Then  the
  927.  condition is re-tested, and if true, the body is executed again. When
  928.  the test becomes false the loop ends, and execution continues at  the
  929.  statements that follows the loop.
  930.  
  931.  For example, to print the value from 1 to 100, you can write
  932.  
  933.       i = 1               ; start from 1
  934.       while i<=100        ; check if it in the range
  935.          print i          ; print the number
  936.          i = i + 1        ; increase the counter by 1
  937.       endwhile
  938.  
  939.  TELEMATE SCRIPT                           STRUCTURED STATEMENTS    14
  940.  
  941.  
  942.  Repeat Loop
  943.  ─────────────────────────────────────────────────────────────────────
  944.  
  945.  While the WHILE loop test the  condition at the top, the REPEAT  loop
  946.  test it at the bottom. It tests at the bottom after making each  pass
  947.  through the loop  body; the body  is always executed  at least  once.
  948.  Consider the loop
  949.  
  950.       REPEAT
  951.          statements
  952.       UNTIL condition
  953.  
  954.  The statements is executed, then the condition is evaluated. If it is
  955.  false, the statements is evaluated again, and so on. If the condition
  956.  becomes true, the loop terminates.
  957.  
  958.  For example, to print the value from 1 to 100, you can write
  959.  
  960.       i = 1               ; start from 1
  961.       repeat
  962.          print i          ; print the number
  963.          i = i + 1        ; increase the counter by 1
  964.       until i>100         ; repeat until it is NOT in the range
  965.  
  966.  
  967.  Exit Statement
  968.  ─────────────────────────────────────────────────────────────────────
  969.  
  970.  It is sometimes  convenient to be  able to control  loop exits  other
  971.  than by testing at the top or bottom. The EXIT statement provides  an
  972.  early exit from the loops. A EXIT statement causes the innermost loop
  973.  to be exited immediately.
  974.  
  975.  The following program accept strings  from keyboard, using a EXIT  to
  976.  exit from the loop when the string contains an [Esc] ("^[").
  977.  
  978.       repeat
  979.          input s
  980.          if "^[" <= s     ; test if [Esc] is a sub-string of s
  981.             exit          ;   before printing it
  982.          endif
  983.          print s
  984.       until s = ""        ; repeat until an empty string is entered
  985.  
  986.  
  987.  #include Directive
  988.  ─────────────────────────────────────────────────────────────────────
  989.  
  990.  This compiler directive allows you to write reusable procedures in  a
  991.  separate file and imports the procedures conveniently. The syntax is
  992.  
  993.       #include "includefile"
  994.  
  995.  
  996.  TELEMATE SCRIPT                           STRUCTURED STATEMENTS    15
  997.  
  998.  
  999.  The <includefile> will  be inserted as  if it is  physical appear  in
  1000.  this point. The <includefile> must be a pathname with extension.  For
  1001.  example,
  1002.  
  1003.       #include "TOOLBOX.SCR"
  1004.       #include "MYLIB.SCR"
  1005.  
  1006.  inserts the TOOLBOX.SCR and MYLIB.SCR into this point.
  1007.  
  1008.  The #include directive can be nested as deep as 10 levels.
  1009.  
  1010.  
  1011.  
  1012.  TELEMATE SCRIPT                                       PROCEDURE    16
  1013.  
  1014.  
  1015.  PROCEDURE
  1016.  
  1017.  In TMScript, a procedure is equivalent to a subroutine or function in
  1018.  Fortran, or  procedure  in Pascal,  C  etc. A  procedure  provides  a
  1019.  convenient way to encapsulate some computation in a black box,  which
  1020.  can then be used without worrying about its innards.
  1021.  
  1022.  For example, to swap  the values of two  variables, <i> and <j>,  you
  1023.  have to write three lines as follows
  1024.  
  1025.       temp = i       ; put <i> into a temporary variable
  1026.       i = j          ; put <j> into <i>
  1027.       j = temp       ; now put the value of <i> into <j>
  1028.  
  1029.  Suppose in  your script  there are  a  lot of  swapping, it  will  be
  1030.  convenient to  define  a  procedure  called  <swap>  to  perform  the
  1031.  swapping. Then your main program will look like
  1032.  
  1033.       i = 1
  1034.       j = 2
  1035.       swap i,j       ; now i=2, j=1
  1036.       print i        ; 2
  1037.       print j        ; 1
  1038.  
  1039.  This is only a small usage of procedure. Imagine if the procedure  is
  1040.  very complex, you can use  it again and again  once it is tested  and
  1041.  performs what you need.
  1042.  
  1043.  Procedure Declaration
  1044.  ─────────────────────────────────────────────────────────────────────
  1045.  
  1046.  The syntax of a procedure definition is
  1047.  
  1048.       PROCEDURE <procname> <parameter declaration>
  1049.       <local variable declaration>
  1050.       <statement part>
  1051.       ENDPROC
  1052.  
  1053.  <procname> is any  valid identifier. <parameter  declaration> can  be
  1054.  omitted if  the  procedure does  not  required parameters.  See  next
  1055.  section for details on parameter declaration.
  1056.  
  1057.  <local variable  declaration>  made  within  a  given  procedure  are
  1058.  visible only  within  that  procedure. This  part  should  ALWAYS  be
  1059.  included in order to make the program easy to be traced although  the
  1060.  declarations may be omitted.
  1061.  
  1062.  <statement part>  can be  considered  as a  sub-program of  the  main
  1063.  program and obeys all the rule described above.
  1064.  
  1065.  
  1066.  
  1067.  TELEMATE SCRIPT                                       PROCEDURE    17
  1068.  
  1069.  
  1070.  Parameter Declaration
  1071.  ─────────────────────────────────────────────────────────────────────
  1072.  
  1073.  Parameter  declaration  is  similar  to  variable  declaration.   For
  1074.  example,
  1075.  
  1076.       PROCEDURE sample STRING s,t,INTEGER i,j
  1077.  
  1078.  declares the procedure  <sample> with two  string parameters <s>  and
  1079.  <t> and  two  integer  parameters  <i>  and  <j>.  You  may  use  any
  1080.  combination of STRING and INTEGER to define parameters. For example,
  1081.  
  1082.       PROCEDURE sample INTEGER i,STRING p,q,r,s,INTEGER j,k,STRING z
  1083.  
  1084.  We can write the <swap> procedure as
  1085.  
  1086.       procedure swap integer value1,value2 ; swap two integers
  1087.       integer temp        ; declare a local variable
  1088.       temp = value1       ; store the first value
  1089.       value1 = value2     ; replace with the second value
  1090.       value2 = temp       ; replace with the first value
  1091.       endproc
  1092.  
  1093.  After that, the main program may look like
  1094.  
  1095.       i = 1
  1096.       j = 2
  1097.       k = 3
  1098.       swap i,j            ; now i=2, j=1
  1099.       swap j,k            ; now j=3, k=1
  1100.       print i,j,k         ; 2,3,1
  1101.  
  1102.  
  1103.  Calling Procedure and Parameter Passing
  1104.  ─────────────────────────────────────────────────────────────────────
  1105.  
  1106.  Once the  procedure is  defined,  it can  be  called by  putting  the
  1107.  procedure name in the statement part. In the example, the statements
  1108.  
  1109.       i = 1
  1110.       j = 2
  1111.       swap i,j            ; now i=2, j=1
  1112.       print i,j           ; 2,1
  1113.  
  1114.  call the <swap> procedure with the parameters <i> and <j>.
  1115.  
  1116.  In the above  example, the method  used to  pass <i> and  <j> to  the
  1117.  procedure <swap> is called  'pass by reference'  because <i> and  <j>
  1118.  can be changed when return. There  is another method called 'pass  by
  1119.  value' of which the parameter cannot be changed.
  1120.  
  1121.  Consider the following procedure
  1122.  
  1123.  
  1124.  TELEMATE SCRIPT                                       PROCEDURE    18
  1125.  
  1126.  
  1127.       procedure CountDown integer num ; print from <num> to 1
  1128.       while num >= 1              ; check if it is in the range
  1129.          print num                ; print it
  1130.          num = num-1              ; decrease until num=0
  1131.       endwhile
  1132.       endproc
  1133.  
  1134.       PrintTo 100                 ; pass by value
  1135.       n = 100
  1136.       PrintTo n*2                 ; pass by value (200)
  1137.       print n                     ; n = 100
  1138.       PrintTo (n)                 ; pass by value (100)
  1139.       print n                     ; n = 100
  1140.       PrintTo n                   ; pass by reference
  1141.       print n                     ; n = 0 !
  1142.  
  1143.  If we supply <CountDown> with the parameter 100, n*2 or (n), they are
  1144.  'pass by value'. On the other hand, <n> is 'pass by reference' in the
  1145.  last statement.
  1146.  
  1147.  The general rule of method of passing parameters is:
  1148.  
  1149.       When the parameter is a constant, an expression or surrounded
  1150.       by parentheses, it is 'pass by value'. Otherwise, it is a
  1151.       variable and is 'pass by reference'.
  1152.  
  1153.  The rule applies to string  parameter as well. To prevent  confusion,
  1154.  we should rewrite  the <CountDown> procedure  by introducing a  local
  1155.  variable.
  1156.  
  1157.       procedure CountDown integer num ; print from <num> to 1
  1158.       integer count               ; introduce a local variable
  1159.       count = num                 ;  if neccessary
  1160.       while count >= 1            ; check if it is in the range
  1161.          print count              ; print it
  1162.          count = count-1          ; decrease until 0
  1163.       endwhile
  1164.       endproc                     ; this does not change <num>
  1165.  
  1166.  
  1167.  Nested Procedures and Scope of Variables
  1168.  ─────────────────────────────────────────────────────────────────────
  1169.  
  1170.  TMScript allows  nested procedures;  you  can declare  one  procedure
  1171.  inside of another. For example,
  1172.  
  1173.       procedure outer
  1174.       string i,j
  1175.  
  1176.          procedure inner
  1177.          integer i
  1178.          i = 100
  1179.          print "i = ",i
  1180.          print "j = ",j
  1181.          endproc
  1182.  
  1183.  
  1184.  TELEMATE SCRIPT                                       PROCEDURE    19
  1185.  
  1186.  
  1187.       i = "This is string 'i'."
  1188.       j = "This is string 'j'."
  1189.       inner
  1190.       print "i = ",i
  1191.       print "j = ",j
  1192.       endproc
  1193.  
  1194.  The <outer> procedure  declares two  string variables,  <i> and  <j>.
  1195.  These two variables can be accessed by both the <outer> procedure and
  1196.  the  <inner>  one  because  they  are  declared  before  the  <inner>
  1197.  procedure.
  1198.  
  1199.  The <inner> procedure declares an integer variable <i>. Although  the
  1200.  two <i>'s share the same name, they are not identical. The inner  <i>
  1201.  is visible in the <inner> procedure but not in the <outer> procedure.
  1202.  On the other hand, the outer <i>  can no longer be accessible in  the
  1203.  <inner> procedure. The statement
  1204.  
  1205.       i = 100
  1206.  
  1207.  does not affect the outer <i>. This is called the scope rule.
  1208.  
  1209.  The output of the program is
  1210.  
  1211.       i = 100
  1212.       j = This is string 'j'.
  1213.       i = This is string 'i'.
  1214.       j = This is string 'j'.
  1215.  
  1216.  
  1217.  Return Statement
  1218.  ─────────────────────────────────────────────────────────────────────
  1219.  
  1220.  Like the EXIT  statement, it is  sometimes convenient to  be able  to
  1221.  return from a procedure at the middle of the procedure.
  1222.  
  1223.  The following procedure  accept strings from  keyboard and print  it,
  1224.  using a RETURN to return from the procedure when the string  contains
  1225.  an [Esc] ("^[").
  1226.  
  1227.       procedure AcceptString string s
  1228.       input s
  1229.       if "^[" <= s     ; test if [Esc] is a sub-string of s
  1230.          Return        ;   before printing it
  1231.       endif
  1232.       print s
  1233.       endproc
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  TELEMATE SCRIPT                 BUILT IN PROCEDURES BY CATEGORY    20
  1239.  
  1240.  
  1241.  
  1242.  BUILT IN PROCEDURES BY CATEGORY
  1243.  
  1244.  Console I/O
  1245.  ─────────────────────────────────────────────────────────────────────
  1246.  
  1247.  There are eight statements in the group of console input and  output.
  1248.  Namely,
  1249.  
  1250.   Input, InputCh, Print, AT, Clear Text, Clear Key, WhereX, WhereY
  1251.  
  1252.  
  1253.  PRINT Statement
  1254.  
  1255.  Output is simple, the PRINT statement can print variable or  constant
  1256.  of types integer or string to the terminal window. For example,
  1257.  
  1258.       print "hello, world"
  1259.  
  1260.  print the words
  1261.  
  1262.       hello, world
  1263.  
  1264.  to the terminal window.
  1265.  
  1266.  PRINT supplies  a  newline automatically.  However,  if a  comma  ","
  1267.  follows the string, no newline is supplied. The statement above could
  1268.  just as well have been written
  1269.  
  1270.       print "hello, ",
  1271.       print "world",
  1272.       print
  1273.  
  1274.  to produce an identical output.  The last PRINT statement supplies  a
  1275.  newline.
  1276.  
  1277.  PRINT statement accepts  more than one  argument. Each two  arguments
  1278.  are separated by a comma. For example,
  1279.  
  1280.       print "x = ",x
  1281.       print "My name is ",FirstName," ",LastName
  1282.       print
  1283.  
  1284.  
  1285.  COM I/O
  1286.  ─────────────────────────────────────────────────────────────────────
  1287.  
  1288.  As a communication program, TMScript provides thirteen I/O statements
  1289.  that communicate with the remote system. They are
  1290.  
  1291.       Get, GetCh, Put, Clear COM, ComInCount, ComOutCount
  1292.       HangUp, Receive, Send, Waitfor, When, WhenIdle
  1293.  
  1294.  
  1295.  TELEMATE SCRIPT                 BUILT IN PROCEDURES BY CATEGORY    21
  1296.  
  1297.  
  1298.  PUT Statement
  1299.  
  1300.  COM output is as simple as console output, the PUT statement can send
  1301.  variable or constant of types integer or string to the remote system.
  1302.  For example,
  1303.  
  1304.       put "FIRST LAST"
  1305.  
  1306.  send the words
  1307.  
  1308.       FIRST LAST
  1309.  
  1310.  and a carriage return [Ctrl M] to the remote system.
  1311.  
  1312.  PUT supplies a carriage return automatically. However, if a comma ","
  1313.  follows the string,  no carriage  return is  supplied. The  statement
  1314.  above could just as well have been written
  1315.  
  1316.       put "FIRST  ",
  1317.       put "LAST",
  1318.       put
  1319.  
  1320.  to produce an  identical output.  The last PUT  statement supplies  a
  1321.  carriage return only.
  1322.  
  1323.  PUT statement accepts more than one argument. Each two arguments  are
  1324.  separated by a comma. For example,
  1325.  
  1326.       put FirstName,";",LastName,";",Password
  1327.  
  1328.  
  1329.  WAITFOR Statement
  1330.  
  1331.  The WAITFOR statements  waits for specified  stirngs from the  remote
  1332.  system in a specified  time. In TMScript, you  can specify more  than
  1333.  one string  to  wait for.  If  any of  them  is received,  the  FOUND
  1334.  variable is set  to a non-zero  value (TRUE). Combined  with the  PUT
  1335.  statement, you can tell Telemate when to send a string to the  remote
  1336.  system.
  1337.  
  1338.    Syntax                         Description
  1339.    ──────────────────────────     ─────────────────────────────────
  1340.    WAITFOR t                      Set default waiting time
  1341.    WAITFOR s1,s2, ... , sN        Wait until one of the strings is
  1342.                                   received
  1343.    WAITFOR s1,s2, ... , sN, t     Wait until one of the strings is
  1344.                                   received or waiting time exceeded
  1345.  
  1346.  For example, the following  code segment are usally  used in a  logon
  1347.  script program.
  1348.  
  1349.       waitfor "first",30        ; wait for "first" in 30 seconds
  1350.       if not found
  1351.          stop                   ; stop if prompt not found
  1352.       endif
  1353.       put "my name"             ; send the name
  1354.  
  1355.  TELEMATE SCRIPT                 BUILT IN PROCEDURES BY CATEGORY    22
  1356.  
  1357.  
  1358.       waitfor "password",5      ; wait for "password" in 5 seconds
  1359.       if not found
  1360.          stop                   ; stop if prompt not found
  1361.       endif
  1362.       put "^&"                  ; send the password field (^&) in
  1363.                                 ;  in the phone directory
  1364.  
  1365.  
  1366.  File Handling
  1367.  ─────────────────────────────────────────────────────────────────────
  1368.  
  1369.  One text file  is allowed  to open  at a time.  The file  is open  or
  1370.  created as a read/write file. The file handling procedures are
  1371.  
  1372.     Open, Created, Append, Read, ReadCh, Write, Seek, Tell, Close,
  1373.     ChDir, Delete, Rename, FileExist, FileSize
  1374.  
  1375.  The predefined  variable SUCCESS  is set  to FALSE  if there  is  any
  1376.  error.
  1377.  
  1378.  
  1379.  String Handling
  1380.  ─────────────────────────────────────────────────────────────────────
  1381.  
  1382.  A string is a  sequence of character.  The limit of  the length of  a
  1383.  string is 512 characters. When referring to a character position, the
  1384.  position is counted from 1. The string handling procedures are
  1385.  
  1386.   Atoi, Concat, Itoa, Length, StrDel, StrIns, StrPos, StrSet, SubStr
  1387.  
  1388.  
  1389.  Miscellaneous Routines
  1390.  ─────────────────────────────────────────────────────────────────────
  1391.   Alarm, Atoi, Date, Delay, Dial, Dos, ExitTelemate, Image, Itoa,
  1392.   Keystroke, LoadFon, LoadKey, LoadMac, LoadPad, LogOff, LogOn,
  1393.   LogPause, LogResume, Query, Script, Set, Time, WaitUntil
  1394.  
  1395.  
  1396.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    23
  1397.  
  1398.  
  1399.  BUILT IN PROCEDURES
  1400.  
  1401.  Alarm
  1402.  ─────────────────────────────────────────────────────────────────────
  1403.  
  1404.  Function     Pop-up the alarm dialog.
  1405.  
  1406.  Syntax       ALARM
  1407.               ALARM message
  1408.  
  1409.  Remarks      If the string <message> is specified, it is displayed in
  1410.               the alarm dialog.
  1411.  
  1412.               If the message is too long, it can be split to several
  1413.               lines by putting a "^J" between each line.
  1414.  
  1415.  Return       If the operator press [Enter] or click the OK button in
  1416.               the alarm dialog, SUCCESS is set to TRUE (non-zero).
  1417.  
  1418.               If the operator press [Esc] or the alarm time excess,
  1419.               SUCCESS is set to FALSE (zero).
  1420.  
  1421.  See also     Set AlarmSound, Set AlarmTime
  1422.  
  1423.  Example
  1424.  
  1425.       receive "s"
  1426.       if not success
  1427.          alarm "Warning: File transfer aborted"
  1428.          if not success  ; if timeout, print message on screen
  1429.             print "Warning: File transfer aborted"
  1430.          endif
  1431.       endif
  1432.  
  1433.       alarm "alarm:^JThis is a^Jvery long message"
  1434.  
  1435.  
  1436.  Append
  1437.  ─────────────────────────────────────────────────────────────────────
  1438.  Function     Opens a text file, creates it if necessary, and moves
  1439.               the file pointer to the end of the file.
  1440.  
  1441.  Syntax       APPEND filename
  1442.  
  1443.  Remark       APPEND opens the text file as a read/write file and
  1444.               strip the ending EOF [Ctrl Z].
  1445.  
  1446.  Return       Upon successful completion, SUCCESS is set to TRUE.
  1447.               If the file cannot be created, SUCCESS is set to FALSE.
  1448.  
  1449.  See also     Create, Open
  1450.  
  1451.  
  1452.  
  1453.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    24
  1454.  
  1455.  
  1456.  At
  1457.  ─────────────────────────────────────────────────────────────────────
  1458.  
  1459.  Function     Positions cursor in terminal window.
  1460.  
  1461.  Syntax       AT column,row
  1462.  
  1463.  Remark       AT moves the cursor to the position within the terminal
  1464.               window. The upper left corner is (0,0) and the lower
  1465.               right corner is (79,24) if a 25 rows terminal is used.
  1466.  
  1467.  See also     Print
  1468.  
  1469.  
  1470.  Atoi
  1471.  ─────────────────────────────────────────────────────────────────────
  1472.  
  1473.  Function     Converts a string to an integer.
  1474.  
  1475.  Syntax       ATOI s,i
  1476.  
  1477.  Return       <i> contains the converted value or 0 if <s> cannot be
  1478.               converted to a number.
  1479.  
  1480.  See also     Itoa
  1481.  
  1482.  
  1483.  ChDir
  1484.  ─────────────────────────────────────────────────────────────────────
  1485.  
  1486.  Function     Changes current directory.
  1487.  
  1488.  Syntax       CHDIR path
  1489.  
  1490.  Remark       CHDIR causes the directory specified by <path> to become
  1491.               the current working directory. <path> must specify an
  1492.               existing directory.
  1493.  
  1494.               A drive can also be specified in <path> but it changes
  1495.               only the current directory on that drive; it doesn't
  1496.               change the active drive.
  1497.  
  1498.  Return       Upon successful completion, SUCCESS is set to TRUE;
  1499.               otherwise, SUCCESS is FALSE.
  1500.  
  1501.  See also     Delete, FileExist, Rename
  1502.  
  1503.  
  1504.  Clear COM
  1505.  ─────────────────────────────────────────────────────────────────────
  1506.  
  1507.  Function     Clears the COM buffer.
  1508.  
  1509.  Syntax       CLEAR COM
  1510.  
  1511.  
  1512.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    25
  1513.  
  1514.  
  1515.  Remark       Data being sent and received are placed in a COM buffer,
  1516.               sometimes it is necessary to clear the buffer before
  1517.               processing.
  1518.  
  1519.  See also     Get, GetCh, Put
  1520.  
  1521.  Example
  1522.  
  1523.       get s      ; get a string
  1524.       delay 50   ; wait for 5 seconds
  1525.       clear com  ; clear the received data in the last 5 seconds
  1526.       get s      ; get another string
  1527.  
  1528.  
  1529.  Clear Key
  1530.  ─────────────────────────────────────────────────────────────────────
  1531.  
  1532.  Function     Clears the keyboard buffer and gives up keyboard control
  1533.               after a INPUT or INPUTCH statement.
  1534.  
  1535.  Syntax       CLEAR KEY
  1536.  
  1537.  Remark       CLEAR KEY clears the content of the keyboard buffer.
  1538.               Keyboard input before this statement are thrown away.
  1539.  
  1540.               When the INPUT or INPUTCH statement in the script is
  1541.               executed, the following input characters are placed in a
  1542.               keyboard buffer no matter if we want to read the next
  1543.               key or not. As a result, the following characters are
  1544.               NOT sent to the remote system automatically. It is
  1545.               important to give up the control of keyboard whenever no
  1546.               more keyboard input is needed and the clear key
  1547.               statement is built for this purpose.
  1548.  
  1549.  See also     Input, InputCh
  1550.  
  1551.  Example
  1552.  
  1553.       print "Input filename:"
  1554.       input filename      ; ask the user to input a filename
  1555.       clear key           ; give up keyboard control such that
  1556.                           ;  following keys are sent to remote
  1557.                           ;  system automatically
  1558.  
  1559.  
  1560.  Clear Text
  1561.  ─────────────────────────────────────────────────────────────────────
  1562.  
  1563.  Function     Clears the terminal window.
  1564.  
  1565.  Syntax       CLEAR TEXT
  1566.  
  1567.  Remark       CLEAR TEST clears the terminal window and positions the
  1568.               cursor to the upper-left corner. It sets the display
  1569.               attribute to the initial setup.
  1570.  
  1571.  
  1572.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    26
  1573.  
  1574.  
  1575.  Close
  1576.  ─────────────────────────────────────────────────────────────────────
  1577.  
  1578.  Function     Closes a file.
  1579.  
  1580.  Syntax       CLOSE
  1581.  
  1582.  Return       Upon successful completion, SUCCESS is set to TRUE;
  1583.               otherwise, SUCCESS is FALSE.
  1584.  
  1585.  See also     Open, Read, Write
  1586.  
  1587.  
  1588.  ComInCount
  1589.  ─────────────────────────────────────────────────────────────────────
  1590.  
  1591.  Function     Gets the number of characters in the incoming COM
  1592.               buffer.
  1593.  
  1594.  Syntax       COMINCOUNT count
  1595.  
  1596.  Remark       Telemate has an incoming COM buffer of 8000 bytes.
  1597.  
  1598.  Return       <count> contains the number of characters in the
  1599.               incoming COM buffer.
  1600.  
  1601.  See also     Clear COM
  1602.  
  1603.  
  1604.  ComOutCount
  1605.  ─────────────────────────────────────────────────────────────────────
  1606.  
  1607.  Function     Gets the number of characters in the outgoing COM
  1608.               buffer.
  1609.  
  1610.  Syntax       COMOUTCOUNT count
  1611.  
  1612.  Remark       Telemate has an outgoing COM buffer of 2000 bytes.
  1613.  
  1614.  Return       <count> contains the number of characters in the
  1615.               outgoing COM buffer.
  1616.  
  1617.  See also     Clear COM
  1618.  
  1619.  
  1620.  
  1621.  Concat
  1622.  ─────────────────────────────────────────────────────────────────────
  1623.  
  1624.  Function     Appends one string to another
  1625.  
  1626.  Syntax       CONCAT dest,src
  1627.  
  1628.  
  1629.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    27
  1630.  
  1631.  
  1632.  Remark       CONCAT appends a copy of <src> to the end of the string
  1633.               <dest>.
  1634.  
  1635.               If the backspace character "^H" is encountered in <src>,
  1636.               the last character of the concatenating string is
  1637.               erased.
  1638.  
  1639.  Return       <dest> contains the concatenated string.
  1640.  
  1641.  See also     Length, StrDel, StrIns
  1642.  
  1643.  Example
  1644.  
  1645.       s = "abc"           ; s = "abc"
  1646.       concat s,"xyz"      ; s = "abcxyz"
  1647.       concat s,"^H"       ; s = "abcxy"
  1648.       concat s,"pq"       ; s = "abcxypq"
  1649.  
  1650.  
  1651.  
  1652.  Create
  1653.  ─────────────────────────────────────────────────────────────────────
  1654.  
  1655.  Function     Creates a new text file or rewrites an existing one.
  1656.  
  1657.  Syntax       CREATE filename
  1658.  
  1659.  Remark       CREATE creates the new text file <filename>. If the
  1660.               file already exists, the old file is deleted.
  1661.  
  1662.  Return       Upon successful completion, SUCCESS is set to TRUE;
  1663.               otherwise, SUCCESS is FALSE.
  1664.  
  1665.  See also     Append, Open
  1666.  
  1667.  
  1668.  Date
  1669.  ─────────────────────────────────────────────────────────────────────
  1670.  
  1671.  Function     Gets system date.
  1672.  
  1673.  Syntax       DATE today
  1674.  
  1675.  Remark       DATE fills the string <today> with the current date
  1676.  
  1677.               Dates can be compared with the usual '<', '>' and '='
  1678.               relational operator.
  1679.  
  1680.               The date format option in the main program does not
  1681.               affect the format in the script language.
  1682.  
  1683.  Return       <today> contains the system current date in MM-DD-YY
  1684.               format.
  1685.  
  1686.  See also     Time, ConvertDate
  1687.  
  1688.  
  1689.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    28
  1690.  
  1691.  
  1692.  Example
  1693.  
  1694.       date today
  1695.       if today>="01-01-91" and today<"01-05-91"
  1696.          print "Happy New Year!"
  1697.       endif
  1698.  
  1699.  
  1700.  Delay
  1701.  ─────────────────────────────────────────────────────────────────────
  1702.  
  1703.  Function     Suspends script execution for an interval.
  1704.  
  1705.  Syntax       DELAY t
  1706.  
  1707.  Remark       With a call to DELAY, the script program is suspended
  1708.               from execution for the number of tenth seconds specified
  1709.               by <t>.
  1710.  
  1711.  Example
  1712.  
  1713.       delay 15  ; wait for one and a half second
  1714.  
  1715.  
  1716.  Delete
  1717.  ─────────────────────────────────────────────────────────────────────
  1718.  
  1719.  Function     Deletes one or more files
  1720.  
  1721.  Syntax       DELETE filename
  1722.  
  1723.  Remark       DELETE deletes one or more files specified by
  1724.               <filename>.
  1725.  
  1726.               Wildcards are allowed in <filename>.
  1727.  
  1728.  Return       On successful completion, SUCCESS is set to TRUE;
  1729.               otherwise, SUCCESS is FALSE.
  1730.  
  1731.  See also     FileExist, Rename
  1732.  
  1733.  
  1734.  Dial
  1735.  ─────────────────────────────────────────────────────────────────────
  1736.  
  1737.  Function     Dials a list of entries or redials the current list.
  1738.  
  1739.  Syntax       DIAL
  1740.               DIAL list
  1741.  
  1742.  Remark       DIAL redials the the current list of entries. If <list>
  1743.               is specified, the current list is replaced by <list> and
  1744.               start dialing.
  1745.  
  1746.               The <DialAttempt> option is the maximum of number of
  1747.               dialing attempt.
  1748.  
  1749.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    29
  1750.  
  1751.  
  1752.               The <DialList> option can be used to specify the current
  1753.               dial list.
  1754.  
  1755.  Return       DIAL sets CONNECTED to the number of the connected
  1756.               entry. If the operator press [Esc] to abort the dialing
  1757.               process or the attempts excess the <DialAttempt> option,
  1758.               CONNECTED is set to 0 (FALSE).
  1759.  
  1760.  See also     Set AutoDial, Set DialAttempt, Set DialList, Set
  1761.               DialPause, Set DialTime, Set MultiLine
  1762.  
  1763.  Example
  1764.  
  1765.       set DialAttempt,3     ; try each entry once
  1766.       set DialList,"1 3 6"  ; set the dial list
  1767.       dial                  ; equivalent to a DIAL "1 3 6" statement
  1768.       if not connected
  1769.          print "All boards are busy."
  1770.       else
  1771.          switch connected
  1772.            case 1: print "connected to #1"
  1773.            case 3: print "connected to #3"
  1774.            case 6: print "connected to #6"
  1775.          endswitch
  1776.       endif
  1777.       set DialAttempt,0     ; unlimit the maximum attempt
  1778.  
  1779.  
  1780.  Dos
  1781.  ─────────────────────────────────────────────────────────────────────
  1782.  
  1783.  Function     Jumps to DOS or issues a DOS command.
  1784.  
  1785.  Syntax       DOS
  1786.               DOS command
  1787.  
  1788.  Remark       The DOS statement invokes the DOS COMMAND.COM file to
  1789.               execute a DOS command, batch file, or other program
  1790.               named by the string <command>. the program must be in
  1791.               the current directory or in one of the directories
  1792.               listed in the PATH string in the environment.
  1793.  
  1794.               If <command> is not specified, the DOS statement jumps
  1795.               to DOS and return when users enter 'EXIT' in the DOS
  1796.               command line.
  1797.  
  1798.               If the <SwapToEms> or the <SwapToDisk> option is turned
  1799.               on, Telemate swaps part of itself to second storage and,
  1800.               hence, leaves more memory space for the DOS shell.
  1801.  
  1802.               The COMSPEC envirnoment string is used to find the
  1803.               COMMAND.COM file. If your COMMAND.COM is not in the
  1804.               root directory - suppose in the C:\DOS directory, you
  1805.               should include the following in the AUTOEXEC.BAT startup
  1806.               file.
  1807.  
  1808.  
  1809.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    30
  1810.  
  1811.  
  1812.                     SET COMSPEC=C:\DOS\COMMAND.COM
  1813.  
  1814.  See also     Set SwapToDisk, Set SwapToEms, Set MaxDosShell
  1815.  
  1816.  Example
  1817.  
  1818.       query SwapToEms,ems     ; store the original options
  1819.       query SwapToDisk,disk
  1820.       query MaxDosShell,max
  1821.       set SwapToEms,on        ; provide more working space
  1822.       set SwapToDisk,on       ;  for external program
  1823.       set MaxDosShell,off     ;
  1824.       dos "TMSTAT TM.USE"     ; run the TMSTAT.EXE program
  1825.       set SwapToEms,ems
  1826.       set SwapToDisk,disk     ; restore the original options.
  1827.       set MaxDosShell,max
  1828.  
  1829.  
  1830.  ExitTelemate
  1831.  ─────────────────────────────────────────────────────────────────────
  1832.  
  1833.  Function     Terminates Telemate's execution.
  1834.  
  1835.  Syntax       EXITTELEMATE
  1836.               EXITTELEMATE exitCode
  1837.  
  1838.  Remark       EXITTELEMATE terminates Telemate and return to DOS. The
  1839.               file in the Edit window is saved automatically if
  1840.               necessary.
  1841.  
  1842.               If <exitCode> is not specified, Telemate exits to DOS
  1843.               with the error level 0. Otherwise, the error level is
  1844.               set to <exitCode>. Typically a value of 0 is used to
  1845.               indicate a normal exit, and a nonzero value indicates
  1846.               some errors.
  1847.  
  1848.  FileExist
  1849.  ─────────────────────────────────────────────────────────────────────
  1850.  
  1851.  Function     Determines if a file or directory is exist.
  1852.  
  1853.  Syntax       FILEEXIST filename,existFlag
  1854.  
  1855.  Remark       FILEEXIST checks the file or directory named by
  1856.               <filename> to determines if it is exists.
  1857.  
  1858.               Wildcards are allowed in <filename>.
  1859.  
  1860.  Return       If the file or directory is exist, <existFlag> is set to
  1861.               TRUE; otherwise, <existFlag> is FALSE.
  1862.  
  1863.  See also     Delete, Rename
  1864.  
  1865.  
  1866.  
  1867.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    31
  1868.  
  1869.  
  1870.  FileSize
  1871.  ─────────────────────────────────────────────────────────────────────
  1872.  
  1873.  Function     Gets file size in bytes.
  1874.  
  1875.  Syntax       FILESIZE filename,size
  1876.  
  1877.  Remark       FILESIZE returns the length, in bytes, of the file
  1878.               specified by <filename>.
  1879.  
  1880.  Return       If <filename> exist, <size> is set to the file size and
  1881.               SUCCESS is set to TRUE; otherwise, SUCCESS is set to
  1882.               FALSE.
  1883.  
  1884.  See also     Read, Seek
  1885.  
  1886.  
  1887.  Get
  1888.  ─────────────────────────────────────────────────────────────────────
  1889.  
  1890.  Function     Gets a string from remote system.
  1891.  
  1892.  Syntax       GET s
  1893.  
  1894.  Remark       GET collects a string, terminated by a carriage return,
  1895.               from the remote system.
  1896.  
  1897.               GET does not eliminate the BackSpace character [Ctrl H]
  1898.               from the input, therefore a CONCAT statement should be
  1899.               perform after the GET statement to eliminate the
  1900.               BackSpace character.
  1901.  
  1902.  Return       <s> contains the collected string. The ending carriage
  1903.               return is discarded.
  1904.  
  1905.  See also     Clear COM, ComInCount, GetCh
  1906.  
  1907.  Example
  1908.  
  1909.       get s               ; get a string from remote system
  1910.       filename = ""       ; prepare the variable
  1911.       concat filename,s   ; eliminate the BackSpace
  1912.  
  1913.  
  1914.  
  1915.  GetCh
  1916.  ─────────────────────────────────────────────────────────────────────
  1917.  
  1918.  Function     Gets a character from remote system.
  1919.  
  1920.  Syntax       GETCH ch
  1921.  
  1922.  Remark       GETCH gets a single character from the remote system.
  1923.               If no character is available, GETCH return immediately.
  1924.               GETCH statement, like the INKEY$ function in BASIC, does
  1925.               not wait.
  1926.  
  1927.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    32
  1928.  
  1929.  
  1930.  Return       If a character is successfully read into <ch>, SUCCESS
  1931.               is set to TRUE; otherwise, SUCCESS is set to FALSE.
  1932.  
  1933.  See also     Get
  1934.  
  1935.  Example
  1936.  
  1937.       repeat         ; to wait for a character,
  1938.          getch ch    ;  repeat the GETCH until
  1939.       until success  ;  a character is available
  1940.  
  1941.  HangUp
  1942.  ─────────────────────────────────────────────────────────────────────
  1943.  
  1944.  Function     HangUps the modem.
  1945.  
  1946.  Syntax       HANGUP
  1947.  
  1948.  Remark       HANGUP sends the modem hangup string to modem. If the
  1949.               hangup string is the "^#" macro sequence, Telemate
  1950.               hangups the modem by dropping DTR.
  1951.  
  1952.  
  1953.  Image
  1954.  ─────────────────────────────────────────────────────────────────────
  1955.  
  1956.  Function     Captures the terminal screen into an image file.
  1957.  
  1958.  Syntax       IMAGE
  1959.               IMAGE filename
  1960.  
  1961.  Remark       IMAGE captures the terminal screen into an image file by
  1962.               appending the screen to the file <filename>. If no
  1963.               <filename> is supplied, the last image filename is used.
  1964.  
  1965.  
  1966.  Input
  1967.  ─────────────────────────────────────────────────────────────────────
  1968.  
  1969.  Function     Reads a string from the keyboard.
  1970.  
  1971.  Syntax       INPUT s
  1972.  
  1973.  Remark       INPUT collects a string, terminated by a [Enter],
  1974.               from the keyboard.
  1975.  
  1976.               When the INPUT statement in the script is executed, the
  1977.               following input characters are placed in a keyboard
  1978.               buffer no matter if they are to be read or not. As a
  1979.               result, they are NOT sent to the remote system auto-
  1980.               matically. It is important to give up the control of
  1981.               keyboard whenever no more keyboard input is needed using
  1982.               the CLEAR KEY statement.
  1983.  
  1984.  
  1985.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    33
  1986.  
  1987.  
  1988.               INPUT does not eliminate the BackSpace character [Ctrl
  1989.               H] from the input, therefore a CONCAT statement should
  1990.               be perform after the INPUT statement to elimate the
  1991.               BackSpace character.
  1992.  
  1993.  Return       <s> contains the collected string. The ending [Enter]
  1994.               is discarded.
  1995.  
  1996.  See also     Clear Key, InputCh
  1997.  
  1998.  Example
  1999.  
  2000.       input s             ; get a string from remote system
  2001.       filename = ""       ; prepare the variable
  2002.       concat filename,s   ; eliminate the BackSpace
  2003.       clear key           ; give up keyboard control such that
  2004.                           ;  following keys are sent to remote
  2005.                           ;  system automatically
  2006.  
  2007.  
  2008.  InputCh
  2009.  ─────────────────────────────────────────────────────────────────────
  2010.  
  2011.  Function     Reads a character from the keyboard.
  2012.  
  2013.  Syntax       INPUTCH ch
  2014.  
  2015.  Remark       INPUTCH gets a single character from the keyboard. If no
  2016.               character is available, INPUTCH returns immediately.
  2017.               INPUTCH statement, like the INKEY$ function in BASIC,
  2018.               does not wait.
  2019.  
  2020.               When the INPUTCH statement in the script is executed,
  2021.               the following input characters are placed in a keyboard
  2022.               buffer no matter if they are to be read or not. As a
  2023.               result, they are NOT sent to the remote system auto-
  2024.               matically. It is important to give up the control of
  2025.               keyboard whenever no more keyboard input is needed using
  2026.               the CLEAR KEY statement.
  2027.  
  2028.  Return       If a character is successfully read into <ch>, SUCCESS
  2029.               is set to TRUE; otherwise, SUCCESS is set to FALSE.
  2030.  
  2031.  See also     Clear Key, Input
  2032.  
  2033.  Example
  2034.  
  2035.       repeat         ; to wait for a character,
  2036.          inputch ch  ;  repeat the INPUTCH until
  2037.       until success  ;  a character is available
  2038.       clear key      ; give up keyboard control such that
  2039.                      ;  following keys are sent to remote
  2040.                      ;  system automatically
  2041.  
  2042.  
  2043.  
  2044.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    34
  2045.  
  2046.  
  2047.  Itoa
  2048.  ─────────────────────────────────────────────────────────────────────
  2049.  
  2050.  Function     Converts an integer to a string.
  2051.  
  2052.  Syntax       ITOA i,s
  2053.  
  2054.  Remark       ITOA converts the integer <i> to a string and store it
  2055.               into <s>.
  2056.  
  2057.  Return       <s> contains the string representation of the value <i>.
  2058.  
  2059.  See also     Atoi
  2060.  
  2061.  
  2062.  Keystroke
  2063.  ─────────────────────────────────────────────────────────────────────
  2064.  
  2065.  Function     Simulates keystrokes.
  2066.  
  2067.  Syntax       KEYSTROKE s
  2068.  
  2069.  Remark       KEYSTROKES simulates keystrokes as if they are generated
  2070.               by the keyboard, including [Alt] keys. It is equivalent
  2071.               to the '^-' keystroke simulation macro, except that the
  2072.               string <s> does not include the '^-' symbol.
  2073.  
  2074.  Example
  2075.  
  2076.       keystroke "`1200`2e00`1400`1900"
  2077.  
  2078.       ; generates [Alt E] [Alt C] [Alt T] [Alt P] which switch to the
  2079.       ; editor, copy the marked text to the clipboard, switch to the
  2080.       ; terminal and paste the content in the clipboard to the remote
  2081.       ; system.
  2082.  
  2083.  
  2084.  Length
  2085.  ─────────────────────────────────────────────────────────────────────
  2086.  
  2087.  Function     Calculates the length of a string.
  2088.  
  2089.  Syntax       LENGTH s,len
  2090.  
  2091.  Return       <len> is the length of <s>. If <s> is an empty, <len>
  2092.               is 0.
  2093.  
  2094.  
  2095.  LoadFon
  2096.  ─────────────────────────────────────────────────────────────────────
  2097.  
  2098.  Function     Loads a phone directory.
  2099.  
  2100.  Syntax       LOADFON phoneDir
  2101.  
  2102.  
  2103.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    35
  2104.  
  2105.  
  2106.  Remark       LOADPAD loads the <phoneDir> with extension .FON and
  2107.               the corresponding memo file .MEM into the dial window.
  2108.  
  2109.               If <phoneDir> does not include a directory, the
  2110.               Telemate directory is used. The extension .FON can be
  2111.               omitted.
  2112.  
  2113.  Return       Upon successful completion, SUCCESS is set to TRUE; if
  2114.               <phoneDir> does not exist, SUCCESS is FALSE.
  2115.  
  2116.  See also     Dial
  2117.  
  2118.  
  2119.  LoadKey
  2120.  ─────────────────────────────────────────────────────────────────────
  2121.  
  2122.  Function     Loads a keyboard definition table.
  2123.  
  2124.  Syntax       LOADKEY keyTable
  2125.  
  2126.  Remark       LOADKEY loads the <keyTable> with extension .KEY.
  2127.  
  2128.               If <keyTable> does not include a directory, the Telemate
  2129.               directory is used. The extension .KEY can be omitted.
  2130.  
  2131.  Return       Upon successful completion, SUCCESS is set to TRUE; if
  2132.               <keyTable> does not exist, SUCCESS is FALSE.
  2133.  
  2134.  
  2135.  LoadMac
  2136.  ─────────────────────────────────────────────────────────────────────
  2137.  
  2138.  Function     Loads a macro definition table.
  2139.  
  2140.  Syntax       LOADMAC macroTable
  2141.  
  2142.  Remark       LOADMAC loads the <macroTable>, with extension .MAC into
  2143.               the macro window.
  2144.  
  2145.               If <macroTable> does not include a directory, the
  2146.               Telemate directory is used. The extension .MAC can be
  2147.               omitted.
  2148.  
  2149.  Return       Upon successful completion, SUCCESS is set to TRUE; if
  2150.               <macroTable> does not exist, SUCCESS is FALSE.
  2151.  
  2152.  
  2153.  LoadPad
  2154.  ─────────────────────────────────────────────────────────────────────
  2155.  
  2156.  Function     Loads a keypad definition table.
  2157.  
  2158.  Syntax       LOADPAD keypadTable
  2159.  
  2160.  
  2161.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    36
  2162.  
  2163.  
  2164.  Remark       LOADPAD loads the <keypadTable>, with extension .PAD
  2165.               into the macro window.
  2166.  
  2167.               If <keypadTable> does not include a directory, the
  2168.               Telemate directory is used. The extension .PAD can be
  2169.               omitted.
  2170.  
  2171.  Return       Upon successful completion, SUCCESS is set to TRUE; if
  2172.               <keypadTable> does not exist, SUCCESS is FALSE.
  2173.  
  2174.  
  2175.  LogOff
  2176.  ─────────────────────────────────────────────────────────────────────
  2177.  
  2178.  Function     Closes the log file.
  2179.  
  2180.  Syntax       LOGOFF
  2181.  
  2182.  Remark       LOGOFF closes a previous opened log file.
  2183.  
  2184.  Return       LOGGING is set to 0 (FALSE).
  2185.  
  2186.  See also     LogOn, LogPause, LogResume
  2187.  
  2188.  
  2189.  LogOn
  2190.  ─────────────────────────────────────────────────────────────────────
  2191.  
  2192.  Function     Opens a log file and captures incoming data into the
  2193.               file.
  2194.  
  2195.  Syntax       LOGON
  2196.               LOGON filename
  2197.  
  2198.  Remark       LOGON opens the log file <filename> and starts capturing
  2199.               the incoming data into it.
  2200.  
  2201.               If <filename> is not supplied, the filename specified in
  2202.               the log file field of the phone directory is used. If
  2203.               this field is empty, "TM.LOG" is used.
  2204.  
  2205.  Return       Upon successful completion, SUCCESS is set to TRUE and
  2206.               LOGGING is set to 1 (TRUE); otherwise, SUCCESS is 0
  2207.               (FALSE).
  2208.  
  2209.  See also     LogOff, LogPause, LogResume
  2210.  
  2211.  
  2212.  LogPause
  2213.  ─────────────────────────────────────────────────────────────────────
  2214.  
  2215.  Function     Pauses capturing incoming data into the log file.
  2216.  
  2217.  Syntax       LOGPAUSE
  2218.  
  2219.  
  2220.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    37
  2221.  
  2222.  
  2223.  Remark       LOGPAUSE pauses capturing incoming data. The LOGGING
  2224.               variable should be checked to determine if a log file
  2225.               open. A value of 1 indicates a log file is open.
  2226.  
  2227.  Return       LOGGING is set to 2.
  2228.  
  2229.  See also     LogOff, LogOn, LogResume
  2230.  
  2231.  
  2232.  LogResume
  2233.  ─────────────────────────────────────────────────────────────────────
  2234.  
  2235.  Function     Resumes capturing incoming data into the log file.
  2236.  
  2237.  Syntax       LOGRESUME
  2238.  
  2239.  Remark       LOGRESUME resumes capturing incoming data. The LOGGING
  2240.               variable should be checked to determine if the log file
  2241.               is in pause. A value of 2 indicates the log file is in
  2242.               pause.
  2243.  
  2244.  Return       LOGGING is set to 1.
  2245.  
  2246.  See also     LogOff, LogOn, LogPause
  2247.  
  2248.  
  2249.  Open
  2250.  ─────────────────────────────────────────────────────────────────────
  2251.  
  2252.  Function     Opens a text file for reading or writing.
  2253.  
  2254.  Syntax       OPEN filename
  2255.  
  2256.  Remark       OPEN opens the text file <filename> for reading and
  2257.               writing and strip the ending EOF [Ctrl Z].
  2258.  
  2259.               OPEN closes the previously open file automatically if no
  2260.               CLOSE command is issued to that file.
  2261.  
  2262.  Return       Upon successful completion, SUCCESS is set to TRUE. If
  2263.               <filename> does not exist, SUCCESS is FALSE.
  2264.  
  2265.  See also     Append, Close, Create, FileExist, FileSize, Read,
  2266.               Read, Seek, Tell, Write
  2267.  
  2268.  Example
  2269.  
  2270.       open "MYFILE"       ; open the file "MYFILE"
  2271.       if not success      ; report if not found
  2272.          print "File not found."
  2273.          stop
  2274.       endif
  2275.       read s              ; read the first line
  2276.       print s             ; print it
  2277.       close               ; close the file
  2278.  
  2279.  
  2280.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    38
  2281.  
  2282.  
  2283.       open "FILE1"        ; open FILE1
  2284.       open "FILE2"        ; close FILE1 and open FILE2
  2285.  
  2286.  
  2287.  Print
  2288.  ─────────────────────────────────────────────────────────────────────
  2289.  
  2290.  Function     Prints integers or strings to the terminal screen.
  2291.  
  2292.  Syntax       PRINT
  2293.               PRINT s
  2294.               PRINT i
  2295.               PRINT s1,s2,i1,i2,s3, ...
  2296.               PRINT s1,s2,i1,i2,s3, ... ,
  2297.  
  2298.  Remark       PRINT outputs variables or constants of integer or
  2299.               string to the terminal screen. Each two arguments are
  2300.               separated by a comma.
  2301.  
  2302.               PRINT supplies a newline by default. If a comma follows,
  2303.               no newline is supplied.
  2304.  
  2305.  See also     At, WhereX, WhereY
  2306.  
  2307.  Example
  2308.  
  2309.       print "hello, world"   ; say hello to everyone
  2310.       print "hello, ",       ; say that again
  2311.       print "world",
  2312.       print
  2313.  
  2314.       print "x = ",x         ; output multiple strings or integers
  2315.       print "My name is ",FirstName," ",LastName
  2316.  
  2317.  
  2318.  
  2319.  Put
  2320.  ─────────────────────────────────────────────────────────────────────
  2321.  
  2322.  Function     Sends strings or integers to the remote system.
  2323.  
  2324.  Syntax       PUT
  2325.               PUT s
  2326.               PUT i
  2327.               PUT s1,s2,i1,i2,s3, ...
  2328.               PUT s1,s2,i1,i2,s3, ... ,
  2329.  
  2330.  Remark       Like the PRINT statement, PUT sends variables or
  2331.               constants of types integer or string to the remote
  2332.               system. Each two arguments are separated by a comma.
  2333.               Integers are converted to their string representation
  2334.               automatically before transmitting to the remote system.
  2335.  
  2336.               PUT supplies a carriage return [Ctrl M] by default. If
  2337.               a comma follows, no carriage return is
  2338.               supplied.
  2339.  
  2340.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    39
  2341.  
  2342.  
  2343.               Control characters can be sent by using the '^' prefix.
  2344.               For example, "^C" represents the [Ctrl C], "^M" the
  2345.               carriage return [Enter] and "^[" the Escape key [Esc].
  2346.  
  2347.               The following macro sequences have special meanings.
  2348.  
  2349.                    ^^     the character '^'
  2350.                    ^~     the character '~'
  2351.                    ~      pause 0.5 second
  2352.                    ^#     drop DTR signal to hangup modem
  2353.                    ^%     break signal
  2354.                    ^$     memo field in phone directory
  2355.                    ^&     password field in phone directory
  2356.                    ^*     modem hangup string
  2357.                    ^(     modem init string
  2358.                    ^)     modem answer string
  2359.  
  2360.  See also     Clear COM, ComOutCount, Waitfor
  2361.  
  2362.  Example
  2363.  
  2364.       put "FIRST LAST"    ; transmit first name and last name
  2365.                           ;  then a carriage return (^M)
  2366.       put "FIRST ",       ; same as above
  2367.       put "LAST",
  2368.       put
  2369.  
  2370.       put                 ; these two lines are
  2371.       put "^M",           ;  equivalent
  2372.  
  2373.       FirstName = "FIRST" ; set first and last name
  2374.       LastName = "LAST"
  2375.       Password = "^&"     ; use the password field in TM.FON
  2376.       put FirstName," ",LastName,"^M~~~~",Password
  2377.              ; send name, [Enter], wait for 2 seconds then send
  2378.              ;  the password, [Enter]
  2379.  
  2380.       put "~^#~~^)",      ; wait 0.5 second, drop DTR,
  2381.                           ;  wait 1 second, then sends the
  2382.                           ;  modem answer string
  2383.  
  2384.  
  2385.  Query
  2386.  ─────────────────────────────────────────────────────────────────────
  2387.  
  2388.  Function     Queries option value.
  2389.  
  2390.  Syntax       QUERY <OPTION>,<VALUE>
  2391.  
  2392.  Remark       The QUERY statement gives you the ability to peek most
  2393.               of the system options.
  2394.  
  2395.               All the options that the SET command accept can be
  2396.               queried by the QUERY command. The returning value is
  2397.               the same as that in the SET command. In addition,
  2398.               the following options are accepted by the QUERY command:
  2399.  
  2400.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    40
  2401.  
  2402.  
  2403.       <OPTION>          <VALUE>     Description
  2404.       ─────────────     ────────    ──────────────────────────────────
  2405.       Board             "..."       return the board name of the
  2406.                                     connected entry
  2407.       Phone             "..."       return the phone number of the
  2408.                                     connected entry
  2409.       Password          "..."       return the password of the
  2410.                                     connected entry
  2411.       Total             nnn         return the total number of
  2412.                                     connection of the connected entry
  2413.       LastCall          "MM-DD-YY"  return the date of the connected
  2414.                                     entry
  2415.       Memo              "..."       return the memo of the connected
  2416.                                     entry
  2417.  
  2418.               This command should be used to store the value of an
  2419.               option before modifying the option and then restore
  2420.               the option to its original before the execution stops.
  2421.  
  2422.  See also     Set
  2423.  
  2424.  Example
  2425.  
  2426.       query zAutoDownload,autoZmodem
  2427.       set zAutoDownload,off
  2428.       receive "z"
  2429.       set zAutoDownload,autoZmodem
  2430.  
  2431.       query board,bbs
  2432.       query password,pw
  2433.       query memo,mm
  2434.       print "#",connected,"   ",bbs,"   ",pw,"   ",mm
  2435.  
  2436.       query diallist,list
  2437.       print list
  2438.  
  2439.       query connection,conn
  2440.       switch conn
  2441.         case 0: print "Modem"
  2442.         case 1: print "Computer"
  2443.         case 2: print "Fossil"
  2444.         case 3: print "BIOS"
  2445.       endswitch
  2446.  
  2447.       query parity,par
  2448.       switch par
  2449.         case 0: print "None"
  2450.         case 1: print "Odd"
  2451.         case 2: print "Even"
  2452.         case 3: print "Space"
  2453.         case 4: print "Mark"
  2454.       endswitch
  2455.  
  2456.       query terminal,term
  2457.       switch term
  2458.         case 0: print "TTY"
  2459.  
  2460.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    41
  2461.  
  2462.  
  2463.         case 1: print "ANSI"
  2464.         case 2: print "VT52"
  2465.         case 3: print "VT102"
  2466.         case 4: print "AVATAR"
  2467.         case 5: print "PRISM"
  2468.       endswitch
  2469.  
  2470.  Read
  2471.  ─────────────────────────────────────────────────────────────────────
  2472.  
  2473.  Function     Reads a string from a text file.
  2474.  
  2475.  Syntax       READ s
  2476.  
  2477.  Remark       READ reads characters from the file into <s>.
  2478.  
  2479.               READ does not place the newline sequence CR-LF into the
  2480.               string.
  2481.  
  2482.  Return       On success, <s> contains the string read and SUCCESS is
  2483.               set to TRUE. SUCCESS is FALSE on end-of-file or error.
  2484.  
  2485.  See also     Close, Open, ReadCh, Seek, Tell
  2486.  
  2487.  Example
  2488.  
  2489.       open "MYFILE"       ; count lines in the file MYFILE
  2490.       if not success
  2491.          print "File not found."
  2492.          stop             ; stop if file not found
  2493.       endif
  2494.       n = 0               ; number of line = 0
  2495.       read str            ; read a line
  2496.       while success       ; repeat until end of file
  2497.          n = n + 1        ; increase counter
  2498.          read str         ; read the next string
  2499.       endwhile
  2500.       close               ; close the file
  2501.       print "There are ",n," lines in the file"
  2502.  
  2503.       open "TM.FON"       ; read a record from the phone directory
  2504.       recno = 10          ; read the record #10
  2505.       reclen = 131        ; record length of a entry
  2506.       seek recno*reclen   ; seek to the record position
  2507.       read record         ; read the record
  2508.       close
  2509.  
  2510.  
  2511.  ReadCh
  2512.  ─────────────────────────────────────────────────────────────────────
  2513.  
  2514.  Function     Reads a character from a text file.
  2515.  
  2516.  Syntax       READCH ch
  2517.  
  2518.  
  2519.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    42
  2520.  
  2521.  
  2522.  Remark       READCH reads a single character from the file into <ch>.
  2523.  
  2524.               In a text file, a CR [Ctrl M] followed by a LF [Ctrl J]
  2525.               indicates end-of-line.
  2526.  
  2527.  Return       On success, <ch> contains the character read and SUCCESS
  2528.               is set to TRUE. SUCCESS is FALSE on end-of-file or
  2529.               error.
  2530.  
  2531.  See also     Close, Open, ReadCh, Seek, Tell
  2532.  
  2533.  
  2534.  Receive
  2535.  ─────────────────────────────────────────────────────────────────────
  2536.  
  2537.  Function     Receives (Downloads) one or more files from the remote
  2538.               system.
  2539.  
  2540.  Syntax       RECEIVE protocol
  2541.               RECEIVE protocol,filename
  2542.  
  2543.  Remark       RECEIVE receives (download) one or more files from the
  2544.               remote system using the protocol <protocol>. <protocol>
  2545.               can be one of the following or the menu key for external
  2546.               protocol.
  2547.  
  2548.               <protocol>     Protocol        <filename> needed
  2549.               ──────────     ────────        ─────────────────
  2550.                  "Z"         Zmodem                 No
  2551.                  "Y"         Ymodem                 No
  2552.                  "G"         Ymodem-G               No
  2553.                  "B"         Batch Ymodem           No
  2554.                  "X"         Xmodem                 Yes
  2555.                  "O"         Xmodem-1K              Yes
  2556.                  "R"         Relaxed Xmodem         Yes
  2557.                  "T"         Telink                 No
  2558.                  "S"         SEAlink                No
  2559.                  "M"         Modem7                 No
  2560.                  "K"         Kermit                 No
  2561.                  "C"         CIS Quick B            No
  2562.                  "A"         ASCII                  Yes
  2563.  
  2564.               For protocols, such as Xmodem, which does not pass the
  2565.               name, <filename> should contains the name being
  2566.               received. Wildcards are not allowed. If <filename> is
  2567.               "" and <GuessFile> option is on, the guessing name is
  2568.               used.
  2569.  
  2570.               Zmodem has the ability to start automatically which is
  2571.               called Zmodem AutoDownload - the <zAutoDownload> option.
  2572.               To prevent the download starts before the command
  2573.               RECEIVE "Z" is issued, the <zAutoDownload> option should
  2574.               be turned off before telling the remote system to start
  2575.               the transfer.
  2576.  
  2577.  
  2578.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    43
  2579.  
  2580.  
  2581.  Return       If the file transfer is successful, SUCCESS is set to
  2582.               TRUE; SUCCESS is FALSE if the transfer abort.
  2583.  
  2584.               For external protocols, SUCCESS is always set to TRUE.
  2585.  
  2586.  See also     Send, Set GuessFile, Set zAutoDownload, Waitfor
  2587.  
  2588.  Example
  2589.  
  2590.       receive "x","file.zip"   ; Xmodem needs the filename
  2591.       receive "y"              ; Ymodem doesn't
  2592.  
  2593.       recieve "x",""           ; use the guessing name as filename
  2594.  
  2595.       query zAutoDownload,auto ; store the auto download option
  2596.       set zAutoDownload,off    ; you must turn it off before you tell
  2597.       waitfor "command",10     ;  the remote system to send the files,
  2598.       put "d z *.zip"          ;  otherwise, the system's AutoDownload
  2599.       receive "z"              ;  procedure will take the control and
  2600.                                ;  the RECEIVE command will return a
  2601.                                ;  wrong SUCCESS value, after the
  2602.       set zAutoDownload,auto   ;  transfer, you may restore it
  2603.       if success
  2604.          print "File received successfully"
  2605.       else
  2606.          print "File transfer aborted"
  2607.       endif
  2608.  
  2609.  
  2610.  Rename
  2611.  ─────────────────────────────────────────────────────────────────────
  2612.  
  2613.  Function     Renames a file.
  2614.  
  2615.  Syntax       RENAME oldname,newname
  2616.  
  2617.  Remark       RENAME changes the name of a file from <oldname> to
  2618.               <newname>.
  2619.  
  2620.               Directories in <oldname> and <newname> need not be the
  2621.               same, therefore, RENAME can be used to move a file from
  2622.               one directory to another. Wildcards are not allowed.
  2623.  
  2624.  Return       On successfully renameing the file, SUCCESS is set to
  2625.               TRUE; otherwise, SUCCESS is FALSE.
  2626.  
  2627.  See also     Delete, FileExist
  2628.  
  2629.  
  2630.  Script
  2631.  ─────────────────────────────────────────────────────────────────────
  2632.  
  2633.  Function     Executes another script program.
  2634.  
  2635.  Syntax       SCRIPT scriptName
  2636.  
  2637.  
  2638.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    44
  2639.  
  2640.  
  2641.  Remark       SCRIPT terminates the execution of the current script
  2642.               and executes the script program <scriptName>.
  2643.  
  2644.               <scriptName> may not contain the extension part of a
  2645.               filename. If <scriptName> does not include a path, the
  2646.               Script directory is used.
  2647.  
  2648.  Example
  2649.  
  2650.       script "HOST" ; executes the HOST.SCR in the Script directory
  2651.  
  2652.  
  2653.  Seek
  2654.  ─────────────────────────────────────────────────────────────────────
  2655.  
  2656.  Function     Repositions the file pointer.
  2657.  
  2658.  Syntax       SEEK filepos
  2659.  
  2660.  Remark       SEEK sets the file pointer to the new position
  2661.               <filepos>. At beginning of a file, the file pointer is
  2662.               0.
  2663.  
  2664.               If <filepos> is -1, the file pointer is moved to the end
  2665.               of the file.
  2666.  
  2667.  Return       If the pointer is successfully moved, SUCCESS is set to
  2668.               TRUE; otherwise, SUCCESS is FALSE.
  2669.  
  2670.  See also     Read, ReadCh, Tell, Write
  2671.  
  2672.  Example                                  
  2673.  
  2674.       ; suppose TM.FON is open, to read record #10 without changing
  2675.       ; the file position, the TELL statement should be used
  2676.       tell filepos     ; store file position
  2677.       seek 10*131      ; move to record #10, each record is 131 bytes
  2678.       read record      ; read the record
  2679.       seek filepos     ; move back to previous position
  2680.  
  2681.  
  2682.  Send
  2683.  ─────────────────────────────────────────────────────────────────────
  2684.  
  2685.  Function     Sends (uploads) one or more files to remote system.
  2686.  
  2687.  Syntax       SEND protocol,filenames
  2688.  
  2689.  Remark       SEND sends (uploads) one or more files to the remote
  2690.               system using the protocol <protocol>. <protocol> can
  2691.               be one of the following or the menu key for external
  2692.               protocol.
  2693.  
  2694.  
  2695.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    45
  2696.  
  2697.  
  2698.               <protocol>     Protocol        Send multiple files
  2699.               ──────────     ────────        ───────────────────
  2700.                  "Z"         Zmodem                 Yes
  2701.                  "Y"         Ymodem                 No
  2702.                  "G"         Ymodem-G               Yes
  2703.                  "B"         Batch Ymodem           Yes
  2704.                  "X"         Xmodem                 No
  2705.                  "O"         Xmodem-1K              No
  2706.                  "R"         Relaxed Xmodem         No
  2707.                  "T"         Telink                 Yes
  2708.                  "S"         SEAlink                Yes
  2709.                  "M"         Modem7                 Yes
  2710.                  "K"         Kermit                 Yes
  2711.                  "C"         CIS Quick B            Yes
  2712.                  "A"         ASCII                  No
  2713.  
  2714.               <filenames> is a list of filenames to be sent, wildcard
  2715.               characters '*' and '?' can be used. If <filename> is
  2716.               "" and <GuessFile> option is on, the guessing name is
  2717.               used. Multiple files are separated by a space. For
  2718.               example,
  2719.                  "\TM\TM210-1.ZIP \TM\TM\210-2.ZIP"
  2720.                  "*.ZIP \UTIL\*.EXE *.TXT"
  2721.  
  2722.               For protocols, such as Xmodem, which cannot transfer
  2723.               multiple files, only the first file in <filenames>.
  2724.  
  2725.  Return       If the file transfer is successful, SUCCESS is set to
  2726.               TRUE; SUCCESS is FALSE if the transfer abort.
  2727.  
  2728.               For external protocols, SUCCESS is always set to TRUE.
  2729.  
  2730.  See also     Receive, Set GuessFile, Waitfor
  2731.  
  2732.  Example                                  
  2733.  
  2734.       send "z","a:*.* b:*.*"      ; Zmodem upload
  2735.       if success
  2736.          print "File sent successfully"
  2737.       else
  2738.          print "File transfer aborted"
  2739.       endif
  2740.  
  2741.  
  2742.  Set
  2743.  ─────────────────────────────────────────────────────────────────────
  2744.  
  2745.  Function     Sets option value.
  2746.  
  2747.  Syntax       SET <OPTION>,<VALUE>
  2748.               SET <OPTION>,<TOKEN>
  2749.  
  2750.  Remark       The SET statement gives you control over many of the
  2751.               system options. The possible options and values are
  2752.               listed below.
  2753.  
  2754.  
  2755.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    46
  2756.  
  2757.  
  2758.       <OPTION>          <VALUE>     Description
  2759.       ─────────────     ────────    ──────────────────────────────────
  2760.       AddLineFeed       0 / 1       when On, a line feed is supplied
  2761.                                     after a carriage return [Ctrl M]
  2762.                                     is received
  2763.       AddReturn         0 / 1       when On, a carriage return is
  2764.                                     supplied after a line feed is
  2765.                                     received
  2766.       AlarmSound        0 - 999     in second, amount of time that
  2767.                                     the alarm music is to be played
  2768.       AlarmTime         0 - 999     in second, amount of time that
  2769.                                     the alarm window is to be shown
  2770.       AutoDial          0 / 1       when On, the remaining in the
  2771.                                     dial list will be dialed upon
  2772.                                     carrier lost
  2773.       AutoStop          0 / 1       when On, the script will stop
  2774.                                     automatically upon carrier lost,
  2775.                                     this setting is reset to Off at
  2776.                                     the beginning of every script
  2777.       AutoWrap          0 / 1       when On, character after column 80
  2778.                                     is wrapped to the new line.
  2779.       Baud            300 - 115200  set baud rate (300,1200,2400,4800,
  2780.                                     9600,19200,38400,57600,115200)
  2781.       Bell              0 / 1       when Off, no bell when [Ctrl G]
  2782.                                     received
  2783.       Capture           0 / 1       when Off, the backscroll buffer
  2784.                                     stops capturing the incoming data
  2785.       CharPacing        0 - 99      in tenth second, amount of time
  2786.                                     that the Paste or ASCII upload
  2787.                                     pause when a character is sent
  2788.       ConfirmHangUp     0 / 1       when On, confirm if required if
  2789.                                     [Alt H] is pressed
  2790.       Connection        0 - 3       set the connection type
  2791.       Data              7 / 8       set data bits
  2792.       DateFormat        0 - 8       set the date format, note that
  2793.                                     this option does not affect
  2794.                                     the date format in the script
  2795.                                     language
  2796.       DestBs            0 / 1       set destructive backspace
  2797.       DialAttempt       0 - 999     the number of attempt that the
  2798.                                     dialing process will perform,
  2799.                                     0 to dial until connected
  2800.       DialList          "..."       set the dial list
  2801.       DialPause         0 - 999     in second, amount of time to be
  2802.                                     wait between two dials
  2803.       DialTime          0 - 999     in second, amount of time to be
  2804.                                     wait after a number is dialed
  2805.       DirEdit           "..."       set the edit directory
  2806.       DirDownload       "..."       set the download directory
  2807.       DirImage          "..."       set the image directory
  2808.       DirLog            "..."       set the log directory
  2809.       DirScript         "..."       set the script directory
  2810.       DirTelemate       "..."       set the telemate directory
  2811.       DirUpload         "..."       set the upload directory
  2812.       DirView           "..."       set the view directory
  2813.       DirWrite          "..."       set the write directory
  2814.  
  2815.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    47
  2816.  
  2817.  
  2818.       ExpandBlankLine   0 / 1       when On, blank lines are
  2819.                                     expanded to lines containing
  2820.                                     a space
  2821.       ExtAlarm          0 / 1       when On, external alarm is used
  2822.       ExtendedPacing    0 - 99      in tenth second, amount of time
  2823.                                     that the Put command or the macro
  2824.                                     keys pause when a character is
  2825.                                     sent
  2826.       GuessFile         0 / 1       when On, guessed name is put in
  2827.                                     the file selection box
  2828.       GuessInitial      0 / 1       when On, guessed initial is put
  2829.                                     in the quote string
  2830.       Incoming          0 / 1       set incoming translation
  2831.       LinePacing        0 - 99      in tenth second, amount of
  2832.                                     time that the Paste function
  2833.                                     pause when a [Ctrl M] is sent
  2834.       LocalEcho         0 / 1       when On, characters are
  2835.                                     displayed in the terminal
  2836.       LogFilter         0 / 1       when On, terminal emulation
  2837.                                     control characters are not
  2838.                                     recorded into the log file
  2839.       LogHeading        0 / 1       when On, a brief heading is
  2840.                                     inserted into the log file
  2841.                                     before recording the incoming
  2842.                                     data
  2843.       MaxDosShell       0 / 1       when On, Telemate swaps most of
  2844.                                     itself out during a DOS shell
  2845.       MultiLine         0 / 1       when On, board names similar to
  2846.                                     the board just connected are
  2847.                                     discarded from the dial list
  2848.       Music             0 / 1       when Off, the music string
  2849.                                     is not interpreted
  2850.       Outgoing          0 / 1       set outgoing translation
  2851.       PaceChar          0 - 255     in ASCII, the character to be
  2852.                                     wait before pasting each line,
  2853.                                     0 to disable this function
  2854.       Parity            0 - 4       set parity
  2855.       Port              1 - 8       set COM port number
  2856.       Prefix            1 - 4       set the dialing prefix
  2857.       Printer           0 / 1       when On, received data is
  2858.                                     sent to printer
  2859.                                     DOS shell
  2860.       RtsCts            0 / 1       set RTS/CTS flow control
  2861.       ScreenSaver       0 - 99      set screen saver
  2862.       Stop              1 / 2       set stop bits
  2863.       StripHighBit      0 / 1       when On, the 8th bit is stripped
  2864.                                     from the incoming data
  2865.       Suffix            1 - 4       set the dialing suffix
  2866.       SwapToDisk        0 / 1       when On, Telemate swaps part
  2867.                                     of itself to disk during DOS
  2868.                                     shell
  2869.       SwapToEms         0 / 1       when On, Telemate swaps part
  2870.                                     of itself to EMS/XMS during
  2871.       Tag               0 - 2       set the tag separator
  2872.       Terminal          0 - 5       set the terminal type
  2873.       UsageLog          0 / 1       set usage log
  2874.  
  2875.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    48
  2876.  
  2877.  
  2878.       XonXoff           0 / 1       set XON/XOFF flow control
  2879.                                     is received
  2880.       zASCII            0 / 1       when On, Zmodem indicates that
  2881.                                     the upload is a ASCII file
  2882.       zAutoDownload     0 / 1       when Off, Zmodem does not
  2883.                                     download automatically
  2884.       zRecovery         0 / 1       when Off, Zmodem does not
  2885.                                     recover aborted transfer
  2886.  
  2887.               Some options allow the use of tokens. Options accept
  2888.               either 0 or 1 (0 / 1) can use Off for 0 and On for 1.
  2889.               The following lists the options that tokens and the
  2890.               corresponding value of the token:
  2891.  
  2892.       Connection, Modem(0)/Computer(1)/Fossil(2)/BIOS(3)
  2893.       Parity, None(0)/Odd(1)/Even(2)/Space(3)/Mark(4)
  2894.       Terminal, TTY(0)/ANSI(1)/VT52(2)/VT102(3)/AVATAR(4)/PRISM(5)
  2895.       Tag, Space(0)/Crlf(1)/Comma(2)
  2896.  
  2897.  See also     Alarm, Dial, Dos, Query, Receive, Send
  2898.  
  2899.  Example
  2900.  
  2901.       BaudRate = 2400
  2902.       set baud,BaudRate   ; set baud rate to 2400
  2903.       set baud,2400       ; same as above
  2904.       set incoming,on     ; turn on incoming translation
  2905.       set terminal,VT102  ; set terminal type to VT102
  2906.  
  2907.  Stop
  2908.  ─────────────────────────────────────────────────────────────────────
  2909.  
  2910.  Function     Terminates the execution of the current script program.
  2911.  
  2912.  Syntax       STOP
  2913.  
  2914.  Remark       STOP is usually used when an error is encountered.
  2915.  
  2916.  See also     ExitTelemate
  2917.  
  2918.  Example
  2919.  
  2920.       open "MYFILE"               ; open a file
  2921.       if not success
  2922.          print "File not found."
  2923.          Stop                     ; terminate if file not found
  2924.       endif
  2925.  
  2926.  
  2927.  StrDel
  2928.  ─────────────────────────────────────────────────────────────────────
  2929.  
  2930.  Function     Deletes characters from a string.
  2931.  
  2932.  Syntax       STRDEL str,pos,count
  2933.  
  2934.  
  2935.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    49
  2936.  
  2937.  
  2938.  Remark       STRDEL deletes <count> characters from the position
  2939.               <pos> of the string <str>.
  2940.  
  2941.               The first character position is 1.
  2942.  
  2943.  Return       <str> contains the new string.
  2944.  
  2945.  See also     Concat, Length, StrIns, StrPos, SetSet, SubStr
  2946.  
  2947.  Example
  2948.  
  2949.       str = "abcXYZdef"
  2950.       strdel str,4,3      ; delete "XYZ"
  2951.       print str           ; "abcdef"
  2952.  
  2953.  
  2954.  StrIns
  2955.  ─────────────────────────────────────────────────────────────────────
  2956.  
  2957.  Function     Inserts a string into another string.
  2958.  
  2959.  Syntax       STRINS str,substr,pos
  2960.  
  2961.  Remark       STRINS inserts a string <substr> into another string
  2962.               <str> at position <pos>.
  2963.  
  2964.               If <pos> is larger than the length of <str>, the gap is
  2965.               filled with spaces. The first character position is 1.
  2966.  
  2967.  Return       <str> contains the new string.
  2968.  
  2969.  See also     Concat, Length, StrDel, StrPos, SetSet, SubStr
  2970.  
  2971.  Example
  2972.  
  2973.       str = "abcdef"
  2974.       strins str,"XYZ",4  ; insert "XYZ"
  2975.       print str           ; "abcXYZdef"
  2976.  
  2977.       str = "abc"
  2978.       strins str,"xyz",10 ; <count> is larger than the length of <str>
  2979.       print str           ; "abc      xyz"
  2980.  
  2981.  
  2982.  StrPos
  2983.  ─────────────────────────────────────────────────────────────────────
  2984.  
  2985.  Function     Scans a string for the occurrence of a given substring.
  2986.  
  2987.  Syntax       STRPOS str,substr,pos
  2988.  
  2989.  Remark       STRPOS scans <str> for the first occurrence of the
  2990.               substring <substr>.  Case is not sensitive.
  2991.  
  2992.               The first character position is 1.
  2993.  
  2994.  
  2995.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    50
  2996.  
  2997.  
  2998.  Return       If <substr> is a substring of <str>, <pos> is the
  2999.               position of the substring; otherwise, <pos> is 0.
  3000.  
  3001.  See also     Concat, Length, StrDel, StrIns, SetSet, SubStr
  3002.  
  3003.  Example
  3004.  
  3005.       strpos "abcdef","def",pos
  3006.       print pos                   ;  4
  3007.  
  3008.  
  3009.  StrSet
  3010.  ─────────────────────────────────────────────────────────────────────
  3011.  
  3012.  Function     Sets part of a string to a given character.
  3013.  
  3014.  Syntax       STRSET str,ch,pos,count
  3015.  
  3016.  Remark       STRSET sets the string <str> starting from position
  3017.               <pos> with <count> character <ch>.
  3018.  
  3019.               If <pos> is larger than the length of <str>, the gap is
  3020.               filled with spaces. The first character position is 1.
  3021.  
  3022.  Return       <str> contains the new string.
  3023.  
  3024.  See also     Concat, Length, StrDel, StrIns, SetPos, SubStr
  3025.  
  3026.  Example
  3027.  
  3028.       str = "abc"
  3029.       strset str,"X",3,10
  3030.       print str           ; "abXXXXXXXXXX"
  3031.  
  3032.  
  3033.  SubStr
  3034.  ─────────────────────────────────────────────────────────────────────
  3035.  
  3036.  Function     Returns a substring from a given string.
  3037.  
  3038.  Syntax       SUBSTR src,pos,count,dest
  3039.  
  3040.  Remark       SUBSTR returns a substring in the string <src> starting
  3041.               at <pos> of length <count> into the string <dest>.
  3042.  
  3043.               The first character position is 1.
  3044.  
  3045.  Return       <dest> contains the substring.
  3046.  
  3047.  See also     Concat, Length, StrDel, StrIns, SetPos, StrSet
  3048.  
  3049.  Example
  3050.  
  3051.       substr "abcdef",1,3,dest
  3052.       print dest                  ; "abc"
  3053.  
  3054.  
  3055.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    51
  3056.  
  3057.  
  3058.  Tell
  3059.  ─────────────────────────────────────────────────────────────────────
  3060.  Function     Returns the current file pointer.
  3061.  
  3062.  Syntax       TELL filepos
  3063.  
  3064.  Remark       TELL returns the current file pointer. <filepos> is
  3065.               measured in bytes from the beginning of the file. At
  3066.               the beginning of the file, <filepos> is 0.
  3067.  
  3068.               Sometime it is neccessary to open more than one file,
  3069.               you can implement it by storing the file position of the
  3070.               original file, then restore it after the other file
  3071.               operation is completed.
  3072.  
  3073.  Return       <filepos> is the current file pointer.
  3074.  
  3075.  See also     Seek, Read, Write
  3076.  
  3077.  Example
  3078.  
  3079.       i = 1
  3080.       filepos = 0                 ; at at beginning of file
  3081.       while i<=10
  3082.          open "bbsname"           ; open data file
  3083.          seek filepos             ; move the previous position
  3084.          read name                ; read a bbs name
  3085.          tell filepose            ; store the current position
  3086.          close                    ; close the file
  3087.          PhoneFind name,number    ; find the board in TM.FON
  3088.                                   ;  suppose the PhoneFind procedure
  3089.                                   ;  open the TM.FON
  3090.          if number<>0             ; yes, it is in TM.FON
  3091.             print name," found is entry #",number
  3092.          endif
  3093.       endwhile
  3094.  
  3095.  
  3096.  Time
  3097.  ─────────────────────────────────────────────────────────────────────
  3098.  
  3099.  Function     Gets system time.
  3100.  
  3101.  Syntax       TIME now
  3102.  
  3103.  Remark       TIME fills the string <now> with the current time.
  3104.  
  3105.               Times can be compared with the usual '<', '>' and '='
  3106.               relational operator.
  3107.  
  3108.  Return       <now> contains the system current date in HH:MM:SS
  3109.               24 hour format.
  3110.  
  3111.  See also     Date
  3112.  
  3113.  
  3114.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    52
  3115.  
  3116.  
  3117.  Example
  3118.  
  3119.       time now
  3120.       if now>"07:00:00" and now<="07:59:59"
  3121.          print "Good morning."
  3122.       endif
  3123.  
  3124.  
  3125.  Usage
  3126.  ─────────────────────────────────────────────────────────────────────
  3127.  
  3128.  Function     Puts a string into the usage file.
  3129.  
  3130.  Syntax       USAGE <usageString>
  3131.  
  3132.  Remark       USAGES puts the string <usageString> into the usage file
  3133.               TM.USE. The current time and date are added to the
  3134.               beginning of the line automatically.
  3135.  
  3136.  Example
  3137.  
  3138.       Usage "Switching to Host mode"
  3139.  
  3140.  
  3141.  Waitfor
  3142.  ─────────────────────────────────────────────────────────────────────
  3143.  
  3144.  Function     Waits for one of the given strings from the remote
  3145.               system.
  3146.  
  3147.  Syntax       WAITFOR t
  3148.               WAITFOR s1,s2, ... , sN
  3149.               WAITFOR s1,s2, ... , sN, t
  3150.  
  3151.  Remark       The 'WAITFOR t' format set the default waiting time to
  3152.               <t>, in second. If <t> is 0, no time checking is
  3153.               performed.
  3154.  
  3155.               The 'WAITFOR s1,s2, ... , sN' format waits until one of
  3156.               the given string is received from the remote system or
  3157.               the default waiting time exceeded.
  3158.  
  3159.               The 'WAITFOR s1,s2, ... , sN,t' format set the default
  3160.               waiting time to <t>, in second and waits until one of
  3161.               the given string is received from the remote system or
  3162.               the waiting time exceeded.
  3163.  
  3164.               Case is not sensitive when comparing the given string
  3165.               with the characters received from the remote system.
  3166.  
  3167.               Sometimes the remote system need a slight delay between
  3168.               the prompt and the response, you can use DELAY or the
  3169.               "~" half-second marco before the PUT command.
  3170.  
  3171.  
  3172.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    53
  3173.  
  3174.  
  3175.  Return       If the waiting time exceeded, FOUND is set to 0 (FALSE);
  3176.               otherwise, FOUND is set the string number of the matched
  3177.               string.
  3178.  
  3179.  See also     Delay, Put, Receive, Send, WaitUntil, When, WhenIdle
  3180.  
  3181.  Example
  3182.  
  3183.       waitfor "first",30        ; wait for "first" in 30 seconds
  3184.       if not found
  3185.          print "Not found."     ; if not found, stop
  3186.          stop
  3187.       else
  3188.          delay 5
  3189.          put "my name"          ; else send the first and
  3190.       endif                     ;  last names
  3191.  
  3192.       ; The following is usually placed at the end of a script file.
  3193.       ; It waits for disconnection and print which string is found.
  3194.  
  3195.       waitfor "NO CARRIER","thanks for calling","hang up now",0
  3196.       print "Ending connection"
  3197.  
  3198.       ; The following simulates the AutoDownload feature for protocols
  3199.       ; does not support this feature.
  3200.  
  3201.       waitfor "Download protocol is",0
  3202.       waitfor "Xmodem","Ymodem","SEAlink",5
  3203.       if found
  3204.          switch found
  3205.             case 1: receive "x","" ; Xmodem, use guessing name
  3206.             case 2: receive "y"    ; Ymodem download
  3207.             case 3: receive "s"    ; SEAlink download
  3208.          endswitch
  3209.       endif
  3210.  
  3211.  
  3212.  WaitUntil
  3213.  ─────────────────────────────────────────────────────────────────────
  3214.  
  3215.  Function     Waits until the specified time exceeded.
  3216.  
  3217.  Syntax       WAITUNTIL t
  3218.  
  3219.  Remark       WAITUNTIL pauses the execution and waits until the time
  3220.               <t>, in HH:MM:SS 24 hour format, exceeded.
  3221.  
  3222.  See also     Wait
  3223.  
  3224.  Example
  3225.  
  3226.       WaitUntil "23:10:30"  ; pause until 11:10:30pm.
  3227.  
  3228.  
  3229.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    54
  3230.  
  3231.  
  3232.  When
  3233.  ─────────────────────────────────────────────────────────────────────
  3234.  
  3235.  Function     Sends a response string to the remote system whenever a
  3236.               given string is matched.
  3237.  
  3238.  Syntax       WHEN <waitString>,<resonseString>
  3239.               WHEN <waitString>,""
  3240.  
  3241.  Remark       The WHEN statement is usually used in the beginning of
  3242.               the script file and it is active until the end of the
  3243.               script file.
  3244.  
  3245.               Whenever the <waitString> is received from the remote
  3246.               system, the <responseString> is transmitted. The
  3247.               response string can be changed. To cancel a WHEN
  3248.               statement, "" should be put in <responseString>.
  3249.  
  3250.               Case is not sensitive when comparing the <waitString>
  3251.               with the characters received from the remote system.
  3252.  
  3253.  See also     Waitfor, WhenIdle
  3254.  
  3255.  Example
  3256.  
  3257.       when "Press ENTER","^M"     ; set response strings
  3258.       when "More [y,n]?","y^M"
  3259.       waitfor "main menu",0       ; wait for "main menu"
  3260.       when "Press ENTER",""       ; cancel response string
  3261.       when "More [y,n]?","n^M"    ; change response string
  3262.       repeat                      ; make the WHEN statements
  3263.       until not connected         ; active until disconnected.
  3264.  
  3265.  
  3266.  WhenIdle
  3267.  ─────────────────────────────────────────────────────────────────────
  3268.  
  3269.  Function     Sends a string to the remote system if there is no COM
  3270.               Input/Output in the specified time.
  3271.  
  3272.  Syntax       WHENIDLE t,s
  3273.  
  3274.  Remark       WHENIDLE monitors the COM Input/Output and sends the
  3275.               string <s> to the remote system if COM I/O is idle for
  3276.               the specified time <t>, in second.
  3277.  
  3278.               Like the WHEN statement, WHENIDLE is active until the
  3279.               end of the script program.
  3280.  
  3281.               <s> can contain macro sequence, such as "^*", the modem
  3282.               hangup string.
  3283.  
  3284.               If <t> is equal to 0 or <s> is a empty string, the
  3285.               WHENIDLE statement will be cancel.
  3286.  
  3287.  See also     Waitfor, When
  3288.  
  3289.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    55
  3290.  
  3291.  
  3292.  Example
  3293.  
  3294.       waitfor "message command",0 ; wait for command prompt
  3295.       put "r"                     ; read message
  3296.       whenidle 30," ^H"           ; prevent inactive timeout
  3297.       repeat                      ; make the WHENIDLE statement
  3298.       until not connected         ; active until disconnected
  3299.  
  3300.       ; There are several usages of this command. The above example
  3301.       ; shows the way to prevent inactive timeout. However, it can
  3302.       ; also be used to handle inactive timeout in the host script
  3303.       ; mode.  For example,
  3304.  
  3305.       whenidle 180,"Inactive timeout^M^J~^*"
  3306.  
  3307.       ; this command checks if the COM I/O is idle for 3 minuates,
  3308.       ; sends a timeout message to the user and, finally, sends the
  3309.       ; hangup string, the hangup macro sequence "^*", to the modem.
  3310.  
  3311.       ; Sometimes the phone line is too noisy that some characters
  3312.       ; cannot be received correctly. The worst case is that those
  3313.       ; characters appear in the WAITFOR string. To prevent inactive
  3314.       ; timeout or waste of connect time, the WHENIDLE can be used as
  3315.       ; follows.
  3316.  
  3317.       whenidle 5,"^M"             ; send a carriage return if idle
  3318.                                   ; for 5 seconds
  3319.       waitfor "first name"        ; now start the log on sequence
  3320.       put "first last"
  3321.       waitfor "password"          ; send password macro
  3322.       put "^&"
  3323.       whenidle 0,""               ; cancel the WHENIDLE statement
  3324.  
  3325.  
  3326.  WhereX
  3327.  ─────────────────────────────────────────────────────────────────────
  3328.  
  3329.  Function     Gives the horizontal cursor position within the terminal
  3330.               window.
  3331.  
  3332.  Syntax       WHEREX column
  3333.  
  3334.  Remark       WHEREX returns the x-coordinate of the terminal window.
  3335.               The left-most column is 0.
  3336.  
  3337.  Return       <column> is the horizontal cursor position.
  3338.  
  3339.  See also     At, WhereX
  3340.  
  3341.  
  3342.  WhereY
  3343.  ─────────────────────────────────────────────────────────────────────
  3344.  
  3345.  Function     Gives the vertical cursor position within the terminal
  3346.               window.
  3347.  
  3348.  
  3349.  TELEMATE SCRIPT                             BUILT IN PROCEDURES    56
  3350.  
  3351.  
  3352.  Syntax       WHEREY row
  3353.  
  3354.  Remark       WHEREY returns the y-coordinate of the terminal window.
  3355.               The top-most row is 0.
  3356.  
  3357.  Return       <row> is the vertical cursor position.
  3358.  
  3359.  See also     At, WhereY
  3360.  
  3361.  
  3362.  Write
  3363.  ─────────────────────────────────────────────────────────────────────
  3364.  
  3365.  Function     Writes integers or strings to a text file.
  3366.  
  3367.  Syntax       WRITE
  3368.               WRITE s
  3369.               WRITE i
  3370.               WRITE s1,s2,i1,i2,s3, ...
  3371.               WRITE s1,s2,i1,i2,s3, ... ,
  3372.  
  3373.  Remark       Like the PRINT statement, WRITE sends variables or
  3374.               constants of types integer or string to the remote
  3375.               system. Each two arguments are separated by a comma.
  3376.               Integers are converted to their string representation
  3377.               automatically before transmitting to the remote system.
  3378.  
  3379.               WRITE supplies a carriage return [Ctrl M] and a line
  3380.               feed [Ctrl J] by default. If a comma follows, no
  3381.               carriage return and line feed is supplied.
  3382.  
  3383.  Return       Upon successful completion, SUCCESS is set to TRUE;
  3384.               otherwise, SUCCESS is FALSE.
  3385.  
  3386.  See also     Read, Seek, Tell
  3387.  
  3388.  Example
  3389.  
  3390.       create "COUNT"      ; write a hundred line into "COUNT"
  3391.       counter = 1         ; initiate the counter
  3392.       while counter<=100  ; repeat 100 times
  3393.          write "This is line ",counter
  3394.       endwhile
  3395.       close               ; close the file
  3396.  
  3397.       newname = "New board name                "
  3398.       open "TM.FON"       ; change the name field of a record
  3399.       recno = 10          ; change the record #10
  3400.       reclen = 131        ; record length of a entry
  3401.       seek recno*reclen   ; seek to the record position
  3402.       write newname,      ; write the name
  3403.       close
  3404.  
  3405.  
  3406.  
  3407.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    57
  3408.  
  3409.  
  3410.  TOOLBOX PROCEDURES
  3411.  
  3412.  The toolboxes are a collection of useful script procedures. They  are
  3413.  written as a supplement  of the built-in  procedures. You may  freely
  3414.  modify the procedures and you are encourage to share your  experience
  3415.  with the other users.
  3416.  
  3417.  The first toolbox defines ANSI color codes and supplies useful  video
  3418.  procedures. The second one includes  three input procedures and  four
  3419.  character-type-checking procedures. The third one provides a standard
  3420.  method to access  the phone directory  and calculates the  difference
  3421.  between two date/time string.
  3422.  
  3423.  To use the toolboxes, you should add the lines
  3424.  
  3425.       #include "toolbox1.scr"         ,
  3426.       #include "toolbox2.scr"         and/or
  3427.       #include "toolbox3.scr"
  3428.  
  3429.  at the  beginning of  your script  file. To  reduce the  size of  the
  3430.  compiled script file,  you should include  only the toolbox(es)  that
  3431.  contain the procedures you need.
  3432.  
  3433.  
  3434.  
  3435.  ─────────────────────────────────────────────────────────────────────
  3436.  Toolbox #1
  3437.  ─────────────────────────────────────────────────────────────────────
  3438.  
  3439.  This toolbox defines video color values,  ANSI color codes and a  set
  3440.  of video  procedures  which  output to  local  screen  and/or  remote
  3441.  system.
  3442.  
  3443.  To use this toolbox, you should add the line
  3444.     #include "toolbox1.scr"       ; include the toolbox
  3445.     TRUE = 1                      ; define boolean value
  3446.     FALSE = 0                     ;  for your convenience
  3447.  at the beginning  of your script  file. This will  increase the  file
  3448.  size of the  compiled script file  .TMS by about  4K. To minimum  the
  3449.  overhead, you should cut and paste the procedures that you used  into
  3450.  your  script  file.  For  example,  the  <EchoBox>  and   <EchoBlock>
  3451.  procedures may be excluded.
  3452.  
  3453.  
  3454.  Color Values and ANSI Color Codes
  3455.  ─────────────────────────────────────────────────────────────────────
  3456.  The following table  shows the  colors values  and its  corresponding
  3457.  foreground and background ANSI codes.
  3458.  
  3459.  
  3460.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    58
  3461.  
  3462.  
  3463.      Color    Symbolic    Foreground     Background
  3464.      Value    Name        ANSI code      ANSI code
  3465.    ──────────────────────────────────────────────────
  3466.        0      BLACK       FGBLACK        BKBLACK
  3467.        1      BLUE        FGBLUE         BKBLUE
  3468.        2      GREEN       FGGREEN        BKGREEN
  3469.        3      RED         FGRED          BKRED
  3470.        4      CYAN        FGCYAN         BKCYAN
  3471.        5      MAGENTA     FGMAGENTA      BKMAGENTA
  3472.        6      YELLOW      FGYELLOW       BKYELLOW
  3473.        7      WHITE       FGWHITE        BKWHITE
  3474.  
  3475.  You can use the  symbolic names to access  a color. For example,  the
  3476.  statement
  3477.  
  3478.      print FGYELLOW,BKBLUE
  3479.  
  3480.  to set the local color to yellow on blue. Or you can use the  toolbox
  3481.  procedures EchoColor and EchoBkColor to set the color. For example,
  3482.  
  3483.      EchoColor YELLOW
  3484.      EchoBkColor BLUE
  3485.  
  3486.  have similar effect to the above.
  3487.  
  3488.  
  3489.  EchoToLocal and EchoToRemote
  3490.  ─────────────────────────────────────────────────────────────────────
  3491.  
  3492.  The  <EchoToLocol>  and  <EchoToRemote>   variables  tell  the   Echo
  3493.  procedures where the output is to be sent. If <EchoToLocal> is  TRUE,
  3494.  the output  is  sent  to  the  local  screen,  default  is  TRUE.  If
  3495.  <EchoToRemote> is  TRUE, the  output is  sent to  the remote  system,
  3496.  default is TRUE. These variables can both be TRUE.
  3497.  
  3498.  
  3499.  Echo and EchoInt
  3500.  ─────────────────────────────────────────────────────────────────────
  3501.  Function     Output a string or an integer to local screen and/or
  3502.               remote system.
  3503.  
  3504.  Syntax       Echo s
  3505.               EchoInt i
  3506.  
  3507.  Remark       ECHO outputs the string <s> while ECHOINT outputs the
  3508.               integer <i> to the local screen and/or remote system
  3509.               according to the variables <EchoToLocal> and
  3510.               <EchoToRemote>.
  3511.  
  3512.               If <EchoToLocal> is TRUE, the output is sent to the
  3513.               local screen.
  3514.  
  3515.               If <EchoToRemote> is TRUE, the output is sent to the
  3516.               remote system.
  3517.  
  3518.  
  3519.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    59
  3520.  
  3521.  
  3522.               Both variables can both be TRUE. In this case, the
  3523.               output is sent to both the local screen and the remote
  3524.               system.
  3525.  
  3526.               All the procedures in this toolbox use these two
  3527.               procedures for output. As a result, the output
  3528.               destination depends on the varaibles <EchoToLocal> and
  3529.               <EchoToRemote> too.
  3530.  
  3531.  Example
  3532.  
  3533.       TRUE  = 1           ; define boolean value
  3534.       FALSE = 0
  3535.  
  3536.       EchoToLocal = TRUE  ; echo to local screen
  3537.       EchoToRemote = FALSE;  but not to remote system
  3538.       Echo "This only display on local screen"
  3539.  
  3540.       EchoToRemoate = TRUE; now echo to remote system too
  3541.       EchoColor YELLOW    ; set yellow foreground
  3542.       EchoHiLite          ; high intensity
  3543.       EchoBkColor BLUE    ; set blue background
  3544.       Echo "Now both local screen and remote system is"
  3545.       Echo "yellow on blue"
  3546.  
  3547.  EchoBkColor
  3548.  ─────────────────────────────────────────────────────────────────────
  3549.  
  3550.  Function     Sets background color.
  3551.  
  3552.  Syntax       ECHOBKCOLOR color
  3553.  
  3554.  Remark       ECHOBKCOLOR sets the background color to <color> by
  3555.               outputing the corresponding background ANSI color code.
  3556.  
  3557.               <color> can be one of the following: BLACK, BLUE,GREEN,
  3558.               CYAN, RED, MAGENTA, YELLOW AND WHITE.
  3559.  
  3560.  See also     EchoColor
  3561.  
  3562.  Example
  3563.  
  3564.       EchoBkColor BLUE    ; blue background
  3565.  
  3566.       EchoColor BLACK     ; black on CYAN
  3567.       EchoBkColor CYAN
  3568.  
  3569.  
  3570.  EchoBlink
  3571.  ─────────────────────────────────────────────────────────────────────
  3572.  
  3573.  Function     Sets blink attribute.
  3574.  
  3575.  Syntax       ECHOBLINK
  3576.  
  3577.  See also     EchoHiLite, EchoNormal, EchoReverse
  3578.  
  3579.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    60
  3580.  
  3581.  
  3582.  Example
  3583.  
  3584.       EchoColor GREEN     ; green foreground
  3585.       EchoBlink           ; blink
  3586.  
  3587.  
  3588.  EchoBlock
  3589.  ─────────────────────────────────────────────────────────────────────
  3590.  
  3591.  Function     Draws a solid block of a character.
  3592.  
  3593.  Syntax       ECHOBLOCK left,top,right,bottom,style,fillchar
  3594.  
  3595.  Remark       ECHOBLOCK draws a filled-in, rectangular block.
  3596.  
  3597.               The upper left and lower right corners of the rectangle
  3598.               are given by (left,top) and (right,bottom). The top-
  3599.               left corner is (0,0).
  3600.  
  3601.               <style> selects the type of block
  3602.                     0     spaces                      ' '
  3603.                     1     widely spaced block         '░'
  3604.                     2     spaced block                '▒'
  3605.                     3     closely spaced block        '▓'
  3606.                     4     solid block                 '█'
  3607.                     5     user-defined fill character <fillchar>
  3608.  
  3609.               <fillchar> should be set to "" for <style> not equal to
  3610.               5.
  3611.  
  3612.  See also     EchoBox
  3613.  
  3614.  Example
  3615.  
  3616.       EchoBlock 5,10,50,15,3,""   ; fill a block with closely spaced
  3617.                                   ;  block '▓'
  3618.       EchoBlock 0,0,79,24,5,"▀"   ; fill the screen with thick
  3619.                                   ;  horizontal line '▀▀▀▀▀▀▀▀'
  3620.  
  3621.  
  3622.  EchoBox
  3623.  ─────────────────────────────────────────────────────────────────────
  3624.  
  3625.  Function     Draws a box.
  3626.  
  3627.  Syntax       ECHOBOX left,top,right,bottom,style,fillchar,hollow
  3628.  
  3629.  Remark       ECHOBOX draws a rectangular box.
  3630.  
  3631.               The upper left and lower right corners of the rectangle
  3632.               are given by (left,top) and (right,bottom). The top-
  3633.               left corner is (0,0).
  3634.  
  3635.  
  3636.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    61
  3637.  
  3638.  
  3639.               <style> selects the type of block
  3640.                     0     spaces
  3641.                     1     single line
  3642.                     2     double line
  3643.                     3     single vertical line, double horizontal line
  3644.                     4     double vertical line, single horizontal line
  3645.                     5     user-defined fill character <fillchar>
  3646.  
  3647.               <fillchar> should be set to "" for <style> not equal to
  3648.               5.
  3649.  
  3650.               If <hollow> is TRUE, the inside of the box is cleared.
  3651.  
  3652.  See also     EchoBlock
  3653.  
  3654.  Example
  3655.  
  3656.       EchoBox 5,10,50,15,2,"",1   ; draw a double-line box and
  3657.                                   ;  clear the inside of it
  3658.       EchoBox 0,0,79,24,5,"█",0   ; draw a solid border but do not
  3659.                                   ;  clear the center
  3660.  
  3661.  
  3662.  EchoClearScreen
  3663.  ─────────────────────────────────────────────────────────────────────
  3664.  
  3665.  Function     Clears the screen and home cursor.
  3666.  
  3667.  Syntax       ECHOCLEARSCREEN
  3668.  
  3669.  Remark       ECHOCLEARSCREEN clears the screen with the current color
  3670.               and positions cursor to the top-left corner.
  3671.  
  3672.  See also     EchoColor, EchoBkColor
  3673.  
  3674.  
  3675.  EchoColor
  3676.  ─────────────────────────────────────────────────────────────────────
  3677.  
  3678.  Function     Sets foreground color.
  3679.  
  3680.  Syntax       ECHOCOLOR color
  3681.  
  3682.  Remark       ECHOCOLOR sets the foreground color to <color> by
  3683.               outputing the corresponding foreground ANSI color code.
  3684.  
  3685.               <color> can be one of the following: BLACK, BLUE,GREEN,
  3686.               CYAN, RED, MAGENTA, YELLOW AND WHITE.
  3687.  
  3688.  See also     EchoBkColor
  3689.  
  3690.  
  3691.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    62
  3692.  
  3693.  
  3694.  Example
  3695.  
  3696.       EchoColor YELLOW    ; yellow foreground
  3697.  
  3698.       EchoColor BLACK     ; black on white
  3699.       EchoBkColor WHITE
  3700.  
  3701.  
  3702.  EchoGotoXY
  3703.  ─────────────────────────────────────────────────────────────────────
  3704.  
  3705.  Function     Positions cursor.
  3706.  
  3707.  Syntax       ECHOGOTOXY column,row
  3708.  
  3709.  Remark       ECHOGOTOXY moves the cursor to the position
  3710.               (column,row). window. The upper left corner is (0,0) and
  3711.               the lower right corner is (79,24) if a 25 rows terminal
  3712.               is used.
  3713.  
  3714.  
  3715.  EchoHiLite
  3716.  ─────────────────────────────────────────────────────────────────────
  3717.  
  3718.  Function     Sets high intensity.
  3719.  
  3720.  Syntax       ECHOHILITE
  3721.  
  3722.  See also     EchoBlink, EchoNormal, EchoReverse
  3723.  
  3724.  Example
  3725.  
  3726.       EchoColor GREEN     ; green foreground
  3727.       EchoHiLite          ; light green
  3728.  
  3729.  
  3730.  EchoNormal
  3731.  ─────────────────────────────────────────────────────────────────────
  3732.  
  3733.  Function     Sets normal intensity and reset color to white on black.
  3734.  
  3735.  Syntax       ECHONORMAL
  3736.  
  3737.  Remark       ECHONORMAL not only set the normal intensity, but also
  3738.               reset the current color to white on black. There is no
  3739.               ANSI code to turn off high intensity.
  3740.  
  3741.               To turn off high intensity only, three statements must
  3742.               be used. You should keep track of the <foreground> and
  3743.               <background> color.
  3744.                   EchoNormal
  3745.                   EchoColor   foreground
  3746.                   EchoBkColor background
  3747.  
  3748.  See also     EchoBlink, EchoHiLite, EchoReverse
  3749.  
  3750.  
  3751.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    63
  3752.  
  3753.  
  3754.  EchoReverse
  3755.  ─────────────────────────────────────────────────────────────────────
  3756.  
  3757.  Function     Sets reverse attribute.
  3758.  
  3759.  Syntax       ECHOREVERSE
  3760.  
  3761.  See also     EchoBlink, EchoHiLite, EchoNormal
  3762.  
  3763.  Example
  3764.  
  3765.       EchoColor YELLOW    ; yellow on blue
  3766.       EchoBkColor BLUE
  3767.       EchoReverse         ; blue on yellow
  3768.  
  3769.  
  3770.  
  3771.  ─────────────────────────────────────────────────────────────────────
  3772.  Toolbox #2
  3773.  ─────────────────────────────────────────────────────────────────────
  3774.  
  3775.  This toolbox defines  three I/O procedures  and four  character-type-
  3776.  checking procedures.
  3777.  
  3778.  To use this toolbox, you should add the line
  3779.     #include "toolbox2.scr"
  3780.  at the beginning  of your script  file. This will  increase the  file
  3781.  size of the  compiled script file  .TMS by about  2K. To minimum  the
  3782.  overhead, you should cut and paste the procedures that you used  into
  3783.  your script file.  For example, the  <InputN> and <ReadN>  procedures
  3784.  may be excluded.
  3785.  
  3786.  
  3787.  GetN
  3788.  ─────────────────────────────────────────────────────────────────────
  3789.  
  3790.  Function     Gets one or more characters from remote system.
  3791.  
  3792.  Syntax       GETN s,n
  3793.  
  3794.  Remark       GETN gets <n> characters from remote system or until CR
  3795.               [Ctrl M] is encountered.
  3796.  
  3797.               The input characters are displayed on local screen.
  3798.  
  3799.               BackSpace character [Ctrl H] deletes the last character
  3800.               of the inputing string. You should leave a space before
  3801.               your input prompt.
  3802.  
  3803.               The CLEAR KEY should be issued if you no longer need
  3804.               keyboard input.
  3805.  
  3806.  Return       <s> contains the input string. If the length of <s> is
  3807.               less than <n>, CR is encountered.
  3808.  
  3809.  See also     Clear COM, Get, GetCh
  3810.  
  3811.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    64
  3812.  
  3813.  
  3814.  Example
  3815.  
  3816.       put "Press a key to continue"
  3817.       getn enter,1        ; wait for a key or [Enter]
  3818.  
  3819.       ; Note: a space is required here ------------v for backspace
  3820.       put "Enter the filename you want to download: "
  3821.       getn filename,50    ; let it handle backspace
  3822.  
  3823.  
  3824.  InputN
  3825.  ─────────────────────────────────────────────────────────────────────
  3826.  
  3827.  Function     Gets one or more characters from keyboard.
  3828.  
  3829.  Syntax       INPUTN s,n
  3830.  
  3831.  Remark       INPUTN gets <n> characters from keyboard or until
  3832.               [Enter] is pressed.
  3833.  
  3834.               BackSpace character [Ctrl H] deletes the last character
  3835.               of the inputing string.
  3836.  
  3837.  Return       <s> contains the input string. If the length of <s> is
  3838.               less than <n>, [Enter] is pressed.
  3839.  
  3840.  See also     At, Clear Key, Input, InputCh
  3841.  
  3842.  Example
  3843.  
  3844.       print "Press a key to continue"
  3845.       inputn enter,1      ; wait for a key or [Enter]
  3846.  
  3847.       print "Enter the filename you want to display: "
  3848.       inputn filename,50  ; let it handle backspace
  3849.  
  3850.  
  3851.  ReadN
  3852.  ─────────────────────────────────────────────────────────────────────
  3853.  
  3854.  Function     Gets one or more characters from a file.
  3855.  
  3856.  Syntax       READN s,n
  3857.  
  3858.  Remark       READN gets <n> characters from the file or until the CR-
  3859.               LF newline sequence is encountered. The CR-LF is
  3860.               skipped in the file and discarded in the string.
  3861.  
  3862.               BackSpace character [Ctrl H] DOES NOT delete the last
  3863.               character of the inputing string.
  3864.  
  3865.               This procedure is usually used to get a field from a
  3866.               data file.
  3867.  
  3868.  Return       <s> contains the input string. If the length of <s> is
  3869.               less than <n>, newline is encountered.
  3870.  
  3871.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    65
  3872.  
  3873.  
  3874.  See also     Read, ReadCh, Seek, Tell
  3875.  
  3876.  Example
  3877.  
  3878.       open "TM.FON"       ; open the phone directory
  3879.       seek 10*131         ; move to entry #10, each entry is 131 bytes
  3880.       readn name,30       ; read the name field
  3881.       close               ; close the phone directory
  3882.  
  3883.  
  3884.  isalpha
  3885.  ─────────────────────────────────────────────────────────────────────
  3886.  
  3887.  Function     Determines if a character is a letter.
  3888.  
  3889.  Syntax       ISALPHA ch,result
  3890.  
  3891.  Return       If <ch> is a letter, <result> is set to TRUE; otherwise
  3892.               <result> is FALSE.
  3893.  
  3894.  See also     isalnum, iscntl, isdigit
  3895.  
  3896.  Example
  3897.  
  3898.       inputn ch,1         ; get one character
  3899.       print
  3900.       isalpha ch,result
  3901.       if result
  3902.          print "yes, it is a letter"
  3903.       else
  3904.          print "no, it is not"
  3905.       endif
  3906.  
  3907.  
  3908.  isalnum
  3909.  ─────────────────────────────────────────────────────────────────────
  3910.  
  3911.  Function     Determines if a character is a letter or a digit.
  3912.  
  3913.  Syntax       ISALNUM ch,result
  3914.  
  3915.  Return       If <ch> is a letter or a digit, <result> is set to TRUE;
  3916.               otherwise <result> is FALSE.
  3917.  
  3918.  See also     isalpha, iscntl, isdigit
  3919.  
  3920.  
  3921.  iscntl
  3922.  ─────────────────────────────────────────────────────────────────────
  3923.  
  3924.  Function     Determines if a character is a control character.
  3925.  
  3926.  Syntax       ISCNTL ch,result
  3927.  
  3928.  Return       If <ch> is a control character ([Ctrl A] to [Ctrl Z]),
  3929.               <result> is set to TRUE; otherwise <result> is FALSE.
  3930.  
  3931.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    66
  3932.  
  3933.  
  3934.  See also     isalpha, isalnum, isdigit
  3935.  
  3936.  
  3937.  isdigit
  3938.  ─────────────────────────────────────────────────────────────────────
  3939.  
  3940.  Function     Determines if a character is a digit.
  3941.  
  3942.  Syntax       ISDIGHT ch,result
  3943.  
  3944.  Return       If <ch> is a digit, <result> is set to TRUE; otherwise
  3945.               <result> is FALSE.
  3946.  
  3947.  See also     isalpha, isalnum, iscntl
  3948.  
  3949.  
  3950.  
  3951.  ─────────────────────────────────────────────────────────────────────
  3952.  Toolbox #3
  3953.  ─────────────────────────────────────────────────────────────────────
  3954.  
  3955.  This toolbox defines several procedures to access the phone directory
  3956.  and two procedures to calculate the difference between two  date/time
  3957.  strings.
  3958.  
  3959.  To use this toolbox, you should add the line
  3960.     #include "toolbox3.scr"
  3961.  at the beginning  of your script  file. This will  increase the  file
  3962.  size of the  compiled script file  .TMS by about  5K. To minimum  the
  3963.  overhead, you should cut and paste the procedures that you used  into
  3964.  your  script  file.  For  example,  the  <DiffTime>  and   <DiffDate>
  3965.  procedures may be excluded.
  3966.  
  3967.  
  3968.  ConvertDate
  3969.  ─────────────────────────────────────────────────────────────────────
  3970.  
  3971.  Function     Converts one date format to another date format.
  3972.  
  3973.  Syntax       CONVERTDATE format1,date1,format2,date2
  3974.  
  3975.  Remark       CONVERTDATE converts the date string <date1> of
  3976.               date format integer <format1> to <date2> of
  3977.               <format2>.
  3978.  
  3979.  Return       <date2> is the equivalent date of the <date1> but
  3980.               <date2> is in date format <format2> and <date1> is
  3981.               in date format <format2>.
  3982.  
  3983.               TMScript only recognizes date string in MM-DD-YY
  3984.               format (i.e. format 0). If you change the date
  3985.               format, it is important to convert it back to the
  3986.               MM-DD-YY before passing it into TMScript internal
  3987.               command, for example comparing two date string.
  3988.  
  3989.  See also     Date
  3990.  
  3991.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    67
  3992.  
  3993.  
  3994.  Example
  3995.  
  3996.       Date today0         ; MM-DD-YY (date format 0)
  3997.  
  3998.       ConvertDate 0,today0,1,today1
  3999.       print today1        ; convert it to DD-MM-YY (date format 1)
  4000.  
  4001.       ConvertDate 1,today1,0,today0
  4002.       print today0        ; back to MM-DD-YY (date format 0)
  4003.  
  4004.  
  4005.  DiffDate
  4006.  ─────────────────────────────────────────────────────────────────────
  4007.  
  4008.  Function     Computes the difference between two dates.
  4009.  
  4010.  Syntax       DIFFDATE date1,date2,days
  4011.  
  4012.  Remark       DIFFDATE calculates the elapsed days from <date1> to
  4013.               <date2> as if
  4014.                   <days> = <date2> - <date1>
  4015.  
  4016.               <date1> and <date2> must be in MM-DD-YY format.
  4017.  
  4018.  Return       <days> is the elapsed days from <date1> to <date2>.
  4019.               <days> is always a non-negative integer.
  4020.  
  4021.               If <date1> is equal to <date2>, <days> is equal 0.
  4022.  
  4023.               If <date1> is larger than <date2>, it is assumed that
  4024.               <date2> pass a century and 100 years is added to <date2>
  4025.               before the calculation.
  4026.  
  4027.  See also     Date, DiffTime
  4028.  
  4029.  Example
  4030.  
  4031.       DiffDate "02-01-88","02-01-89",days
  4032.       print days          ; 366
  4033.  
  4034.       DiffDate "02-01-91","03-01-91",days
  4035.       print days          ; 28
  4036.  
  4037.       DiffDate "12-31-99","01-01-00",days ; 1999 - 2000
  4038.       print days          ; 1
  4039.  
  4040.  
  4041.  DiffTime
  4042.  ─────────────────────────────────────────────────────────────────────
  4043.  
  4044.  Function     Computes the difference between two times.
  4045.  
  4046.  Syntax       DIFFTIME time1,time2,seconds
  4047.  
  4048.  
  4049.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    68
  4050.  
  4051.  
  4052.  Remark       DIFFTIME calculates the elapsed seconds from <time1> to
  4053.               <time2> as if
  4054.                   <seconds> = <time2> - <time1>
  4055.  
  4056.               <time1> and <time2> must be in HH:MM:SS format.
  4057.  
  4058.  Return       <seconds> is the elapsed seconds from <time1> to
  4059.               <time2>. <seconds> is always a non-negative integer.
  4060.  
  4061.               If <time1> is equal to <time2>, <seconds> is equal 0.
  4062.  
  4063.               If <time1> is larger than <time2>, it is assumed that
  4064.               <time2> pass midnight and 24 hours is added to <time2>
  4065.               before the calculation.
  4066.  
  4067.  See also     DiffDate, Time
  4068.  
  4069.  Example
  4070.  
  4071.       DiffTime "12:30:40","12:31:30",seconds
  4072.       print seconds       ; 50
  4073.  
  4074.       DiffTime "23:59:50","00:00:01",seconds  ; pass mid-night
  4075.       print seconds       ; 11
  4076.  
  4077.  
  4078.  PhoneDirectory
  4079.  ─────────────────────────────────────────────────────────────────────
  4080.  
  4081.  The <PhoneDirectory>  variable  tells the  Phone's  procedures  which
  4082.  phone directory is to be access. Default is the "TM.FON".
  4083.  
  4084.  Example
  4085.  
  4086.       PhoneDirectory = "MYPHONE.FON"
  4087.       PhoneFind "South",number,1  ; search the word "South" in
  4088.                                   ; MYPHONE.FON
  4089.  
  4090.  
  4091.  PhoneFind
  4092.  ─────────────────────────────────────────────────────────────────────
  4093.  
  4094.  Function     Finds an entry.
  4095.  
  4096.  Syntax       PHONEFIND name,number,startPoint
  4097.  
  4098.  Remark       PHONEFIND finds an entry by <name> starting from
  4099.               <startPoint>.
  4100.  
  4101.  Return       If <name> matches an entry, <number> is set the entry
  4102.               number; otherwise, <number> is 0.
  4103.  
  4104.               <success> is FALSE if the phone directory cannot be
  4105.               open.
  4106.  
  4107.  
  4108.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    69
  4109.  
  4110.  
  4111.  Caution      This procedure will close the formly opened file since
  4112.               the OPEN command is used. You should close the file
  4113.               before issuing this procedure and reopen the file after
  4114.               this procedure.
  4115.  
  4116.  See also     PhoneDirectory, PhoneRead, PhoneSize, PhoneWrite
  4117.  
  4118.  Example
  4119.  
  4120.       ; To start from the beginning of the phone directory
  4121.       PhoneFind "South",number,1
  4122.       if not found
  4123.          print "String not found"
  4124.          stop
  4125.       endif
  4126.  
  4127.       PhoneRead number,name,password,link,log,phone,total,last
  4128.       print "...."
  4129.  
  4130.       ; To go on search, supply <startPoint> with the next number
  4131.       PhoneFind "South",number,number+1
  4132.       print "...."
  4133.  
  4134.  
  4135.  PhoneRead
  4136.  ─────────────────────────────────────────────────────────────────────
  4137.  
  4138.  Function     Reads an entry
  4139.  
  4140.  Syntax       PHONEREAD number,name,password,linkscript,logfile,
  4141.                         phone,total,last
  4142.  
  4143.  Remark       PHONEREAD reads the entry # <number> into the variables.
  4144.               <total> is an integer variable. The others are string
  4145.               variables.
  4146.  
  4147.               You must provide a valid entry <number>. The size of
  4148.               the phone directory can be obtained by the PHONESIZE
  4149.               procedure.
  4150.  
  4151.  Return       <name> is the name field,
  4152.               <password> is the password field,
  4153.               <linkscript> is the script field,
  4154.               <logfile> is the log file field,
  4155.               <phone> is the phone number,
  4156.               <total> is the total number connected, an integer,
  4157.               <last> is the last logon date.
  4158.               Tailing spaces in each variables are discarded.
  4159.  
  4160.               <success> is FALSE if the phone directory cannot be
  4161.               open.
  4162.  
  4163.  Caution      This procedure will close the formly opened file since
  4164.               the OPEN command is used. You should close the file
  4165.               before issuing this procedure and reopen the file after
  4166.               this procedure.
  4167.  
  4168.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    70
  4169.  
  4170.  
  4171.  See also     PhoneDirectory, PhoneFind, PhoneSize, PhoneWrite
  4172.  
  4173.  Example
  4174.  
  4175.       PhoneSize size              ; get the size
  4176.       number = 1                  ; start the counter
  4177.       while number <= size        ; display all entries
  4178.          PhoneRead number,name,password,link,log,phone,total,last
  4179.          print "BBS name:",name," phone:",phone," last on:",last
  4180.          number = number + 1      ; next entry
  4181.       endif
  4182.  
  4183.  
  4184.  PhoneSize
  4185.  ─────────────────────────────────────────────────────────────────────
  4186.  
  4187.  Function     Gets the number of entries in a phone directory.
  4188.  
  4189.  Syntax       PHONESIZE size
  4190.  
  4191.  Remark       PHONESIZE calculated the phone directory size by
  4192.                 <size> = <file size of .fon> / 131
  4193.               Each entries is 131 bytes.
  4194.  
  4195.  Return       <success> is FALSE if the phone directory cannot be
  4196.               open.
  4197.  
  4198.  See also     PhoneDirectory, PhoneFind, PhoneRead, PhoneWrite
  4199.  
  4200.  
  4201.  PhoneWrite
  4202.  ─────────────────────────────────────────────────────────────────────
  4203.  
  4204.  Function     Writes an entry
  4205.  
  4206.  Syntax       PHONEWRITE number,name,password,linkscript,logfile,
  4207.                          phone,total,last
  4208.  
  4209.  Remark       PHONEWRITE writes the entry # <number> from the
  4210.               variables. <total> is an integer variable. The others
  4211.               are string.
  4212.  
  4213.               <name> is the name field,
  4214.               <password> is the password field,
  4215.               <linkscript> is the script field,
  4216.               <logfile> is the log file field,
  4217.               <phone> is the phone number,
  4218.               <total> is the total number connected, an integer,
  4219.               <last> is the last logon date.
  4220.               Tailing spaces in each variables should have been
  4221.               discarded.
  4222.  
  4223.  Return       <success> is FALSE if the phone directory cannot be
  4224.               open.
  4225.  
  4226.  
  4227.  TELEMATE SCRIPT                              TOOLBOX PROCEDURES    71
  4228.  
  4229.  
  4230.  Caution      This procedure will close the formly opened file since
  4231.               the OPEN command is used. You should close the file
  4232.               before issuing this procedure and reopen the file after
  4233.               this procedure.
  4234.  
  4235.  See also     PhoneDirectory, PhoneFind, PhoneRead, PhoneSize
  4236.  
  4237.  Example
  4238.  
  4239.       PhoneRead 10,name,password,link,log,phone,total,last
  4240.       total = total+1     ; total is an integer variable
  4241.       date last           ; get today's date
  4242.       PhoneWrite 10,name,password,link,log,phone,total,last
  4243.  
  4244.  
  4245.  TELEMATE SCRIPT                      APPENDIX A: ERROR MESSAGES    72
  4246.  
  4247.  
  4248.  APPENDIX A: ERROR MESSAGES
  4249.  
  4250.  Compiler Error Messages
  4251.  ─────────────────────────────────────────────────────────────────────
  4252.  
  4253.  "'CASE' expected"
  4254.  
  4255.  "Declaration error"
  4256.  
  4257.  A symbol is placed in  wrong sequence the  declaration part. You  may
  4258.  have forgotten the comma between two variables.
  4259.  
  4260.  "'ENDIF' expected"
  4261.  
  4262.  "'ENDPROC' expected"
  4263.  
  4264.  "'ENDSWITCH' expected"
  4265.  
  4266.  "'ENDWHILE' expected"
  4267.  
  4268.  "Identifier expected"
  4269.  
  4270.  An identifier was expected at this point. You may be trying to use  a
  4271.  reserved word as an variable.
  4272.  
  4273.  "Invalid expression"
  4274.  
  4275.  This symbol cannot participate in an  expression in the way it  does.
  4276.  You may have forgotten to write an operator between two operands.
  4277.  
  4278.  "Invalid option"
  4279.  
  4280.  You have  mistyped the  option  or forgotten  the comma  between  the
  4281.  option and the value.
  4282.  
  4283.  "Invalid parameter"
  4284.  
  4285.  Too many or too few parameter in calling a procedure.
  4286.  
  4287.  "Invalid sequence"
  4288.  
  4289.  The symbol cannot at a statement.
  4290.  
  4291.  "Invalid string operation"
  4292.  
  4293.  An arithmetic operator is applied to string expression. To concat two
  4294.  strings, use the 'ConCat' function.
  4295.  
  4296.  "Misplacing Exit statement"
  4297.  
  4298.  The EXIT can only be  placed in WHILE and  REPEAT loop. You may  have
  4299.  put it outside a loop.
  4300.  
  4301.  
  4302.  TELEMATE SCRIPT                      APPENDIX A: ERROR MESSAGES    73
  4303.  
  4304.  
  4305.  "New line expected"
  4306.  
  4307.  Every statement should be in a line.
  4308.  
  4309.  "Nested too deep"
  4310.  
  4311.  TMScript allows no more than 10 nested procedures.
  4312.  
  4313.  "Number out of range"
  4314.  
  4315.  Integer must within the range from -2147483648 to 2147483647.
  4316.  
  4317.  "Numeric expression expected"
  4318.  
  4319.  The preceding expression must be of integer type.
  4320.  
  4321.  "Program Incomplete - Unexpected end of file"
  4322.  
  4323.  Your source file ends due to unbalanced begins and ends. Check the IF
  4324.  statement, SWITCH statement,  WHILE loop, REPEAT  loop and  procedure
  4325.  definition.
  4326.  
  4327.  "Script file not found"
  4328.  
  4329.  The include script of the #include directive does not exist. You  may
  4330.  have forgotten the ".SCR" extension or not having the include  script
  4331.  in the current directory.
  4332.  
  4333.  "String expression expected"
  4334.  
  4335.  The preceding expression must be of string type.
  4336.  
  4337.  "String incomplete"
  4338.  
  4339.  You have most likely forgotten the ending quote in a string constant.
  4340.  
  4341.  "Syntax error"
  4342.  
  4343.  An illegal  character was  found in  the source  file. You  may  have
  4344.  forgotten the quotes around a string constant.
  4345.  
  4346.  "Too many include scripts"
  4347.  
  4348.  TMScript allows no more than 10 nested include file.
  4349.  
  4350.  "Type mismatch"
  4351.  
  4352.  This is due to incompatible types of the variable and the  expression
  4353.  in an assignment statement  or incompatible types  of operands in  an
  4354.  expression.
  4355.  
  4356.  "'UNTIL' expected"
  4357.  
  4358.  
  4359.  TELEMATE SCRIPT                      APPENDIX A: ERROR MESSAGES    74
  4360.  
  4361.  
  4362.  "',' expected"
  4363.  
  4364.  "':' expected"
  4365.  
  4366.  "')' expected"
  4367.  
  4368.  "'=' expected"
  4369.  
  4370.  "'"' expected"
  4371.  
  4372.  
  4373.  Runtime Error Messages
  4374.  ─────────────────────────────────────────────────────────────────────
  4375.  
  4376.  "Division by zero"
  4377.  
  4378.  A number is divided by a expression of zero.
  4379.  
  4380.  "Invalid format in script file"
  4381.  
  4382.  Make sure the .TMS file is a compiled script file. You should compile
  4383.  the script file using TMS.EXE.
  4384.  
  4385.  "Out of memory"
  4386.  
  4387.  This error  occurs  when TM.EXE  is  run  out of  memory  and  cannot
  4388.  allocate enough memory to the script file.
  4389.  
  4390.  "Stack overflow"
  4391.  
  4392.  This error is  reported on  entry to a  procedure when  there is  not
  4393.  enough stack space to allocate the procedure's local variables.
  4394.  
  4395.  
  4396.  TELEMATE SCRIPT                                           INDEX    75
  4397.  
  4398.  INDEX
  4399.  
  4400.  .SCR file, 1                       Comma, 48
  4401.  .TMS file, 1                       Compiling Script, 1
  4402.                                     Compiler Error Message, 74
  4403.  A                                  Computer, 48
  4404.                                     Concat, 26
  4405.  AddLineFeed, 46                    ConfirmHangUp, 46
  4406.  AddReturn, 46                      CONNECTED, 5, 29
  4407.  Alarm, 23                          Connection, 46
  4408.  AlarmSound, 46                     Console I/O, 20
  4409.  AlarmTime, 46                      Control Code, 3
  4410.  ANSI, 48                           ConvertDate, 66
  4411.  ANSI Color Code, 57                Create, 7, 27
  4412.  Append, 6, 23                      Crlf, 48
  4413.  Arithmetic Operators, 9
  4414.  Assignment, 11                     D
  4415.  At, 24
  4416.  Atoi, 24                           Data Type, 3
  4417.  AutoDial, 46                       Data, 46
  4418.  AutoStop, 46                       Date, 4, 27
  4419.  AutoWrap, 46                       DateFormat, 46
  4420.  Avatar, 48                         Delay, 28
  4421.                                     Delete, 7, 28
  4422.  B                                  DestBs, 46
  4423.                                     Dial, 28
  4424.  Background Color Code, 58          DialAttempt, 46
  4425.  Baud, 46                           DialList, 46
  4426.  Bell, 46                           DialPause, 46
  4427.  BIOS, 48                           DialTime, 46
  4428.  Board, 40                          DiffDate, 67
  4429.  Boolean, 4                         DiffTime, 67
  4430.  Boolean Operators, 9               DirEdit, 46
  4431.  Built In Procedures, 20, 23        DirDownload, 46
  4432.                                     DirImage, 46
  4433.  C                                  DirLog, 46
  4434.                                     DirScript, 46
  4435.  Calling Procedure, 17              DirTelemate, 46
  4436.  Capture, 46                        DirUpload, 46
  4437.  Character, 3                       DirView, 46
  4438.  CharPace, 46                       DirWrite, 46
  4439.  ChDir, 6, 24                       Dos, 29
  4440.  Clear COM, 24                      Download, 42
  4441.  Clear Key, 25
  4442.  Clear Text, 25                     E
  4443.  Close, 6, 26
  4444.  Color Code, 57                     Echo, 58
  4445.  Color Value, 57                    EchoBkColor, 59
  4446.  COM I/O, 20                        EchoBlink, 59
  4447.  ComInCount, 26                     EchoBlock, 60
  4448.  ComOutCount, 26                    EchoBox, 60
  4449.  Comment, 11                        EchoClearScreen, 61
  4450.  Comparison, 10                     EchoColor, 61
  4451.  
  4452.  
  4453.  
  4454.  TELEMATE SCRIPT                                           INDEX    76
  4455.  
  4456.  
  4457.  EchoGotoXY, 62                     I
  4458.  EchoHiLite, 62
  4459.  EchoNormal, 62                     If, 11
  4460.  EchoReverse, 63                    Image, 32
  4461.  EchoInt, 62                        Incoming, 47
  4462.  EchoToLocal, 62                    Include Directive, 14
  4463.  EchoToRemote, 62                   Input, 32
  4464.  Else, 12                           InputCh, 33
  4465.  ElseIf, 12                         InputN, 64
  4466.  EndIf, 11                          Integer, 3
  4467.  EndSwitch, 12                      Isalpha, 65
  4468.  EndWhile, 13                       Isalnum, 65
  4469.  Error Messages, 72                 Iscntl, 65
  4470.  Even, 48                           Isdigit, 66
  4471.  Exit, 14                           Itoa, 34
  4472.  ExitTelemate, 30
  4473.  Expand Blank Line, 47              K
  4474.  Expression, 9
  4475.  ExtAlarm, 47                       Keystroke, 34
  4476.  ExtendedPacing, 47
  4477.                                     L
  4478.  F
  4479.                                     LastCall, 40
  4480.  FALSE, 4                           Length, 34
  4481.  File Handling, 22                  LinePacing, 47
  4482.  FileExist, 30                      LoadFon, 7, 34
  4483.  FileSize, 7, 31                    LoadKey, 7, 35
  4484.  Foregound Color Code, 57           LoadMac, 7, 35
  4485.  Fossil, 48                         LoadPad, 7, 35
  4486.  FOUND, 6, 21, 53                   LocalEcho, 47
  4487.                                     LogFilter, 47
  4488.  G                                  Logging, 8, 36, 37
  4489.                                     LogHeading, 47
  4490.  Get, 31                            LogOff, 36
  4491.  GetCh, 31                          LogOn, 36
  4492.  GetN, 63                           LogPause, 37
  4493.  GuessFile, 47                      LogResume, 37
  4494.  GuessInitial, 47
  4495.                                     M
  4496.  H
  4497.                                     Mark, 48
  4498.  HangUp, 32                         MaxDosShell, 47
  4499.  Height, 8                          Memo, 40
  4500.                                     Miscellaneous Routines, 22
  4501.                                     Modem, 48
  4502.                                     MultiLine, 47
  4503.                                     Music, 47
  4504.  
  4505.  TELEMATE SCRIPT                                           INDEX    77
  4506.  
  4507.  
  4508.  N
  4509.                                     S
  4510.  Nested Procedures, 18
  4511.  None, 48                           ScreenSaver, 47
  4512.                                     Script, 43
  4513.  O                                  Scope of Variables, 18
  4514.                                     Seek, 7, 44
  4515.  Odd, 48                            Send, 7, 44
  4516.  Open, 7, 37                        Set, 45
  4517.  Otherwise, 12                      Space, 48
  4518.  Outgoing, 47                       Statement, 11
  4519.                                     Stop, 47, 48
  4520.  P                                  StrDel, 48
  4521.                                     String, 3
  4522.  PaceChar, 47                       String Handling, 22
  4523.  Parity, 47                         StrIns, 49
  4524.  Parameter Declaration, 17          StripHighBit, 47
  4525.  Parameter Passing, 17              StrPos, 49
  4526.  Password, 40                       StrSet, 50
  4527.  Phone, 40                          SubStr, 50
  4528.  PhoneDirectory, 68                 SUCCESS, 6
  4529.  PhoneFind, 68                      Suffix, 47
  4530.  PhoneRead, 69                      SwapToDisk, 47
  4531.  PhoneSize, 70                      SwapToEMS, 47
  4532.  PhoneWrite, 70                     Switch, 12
  4533.  Port, 47
  4534.  Precedence, 9                      T
  4535.  Predefined Variables, 5
  4536.  Prefix, 47                         Tag, 47
  4537.  Print, 20, 38                      Tell, 7, 51
  4538.  Printer, 47                        Terminal, 47
  4539.  Prism, 48                          Time, 4, 51
  4540.  Procedure Declaration, 16          Toolbox Procedures, 57
  4541.  Procedure, 16                      Toolbox #1, 57
  4542.  Protocol, 42, 45                   Toolbox #2, 63
  4543.  Put, 21, 38                        Toolbox #3, 66
  4544.                                     Total, 40
  4545.  Q                                  TRUE, 4
  4546.                                     TTY, 48
  4547.  Query, 39
  4548.                                     U
  4549.  R
  4550.                                     Until, 14
  4551.  Read, 7, 41                        Upload, 44
  4552.  ReadCh, 7, 41                      Usage, 52
  4553.  ReadN, 64                          UsageLog, 47
  4554.  Receive, 7, 42                     Using TMS.EXE, 1
  4555.  Relational Operators, 10
  4556.  Rename, 43                         V
  4557.  Repeat, 14
  4558.  Return, 7, 19                      Variable, 5
  4559.  RtsCts, 47                         Variable Identifier, 5
  4560.  Rule of Precedance, 9              Variable Declaration, 5
  4561.  Running Script, 1                  VT52, 48
  4562.  Runtime Error Messages, 79         VT102, 48
  4563.  
  4564.  
  4565.  TELEMATE SCRIPT                                           INDEX    78
  4566.  
  4567.  
  4568.  W
  4569.  
  4570.  Waitfor, 52
  4571.  WaitUntil, 53
  4572.  When, 54
  4573.  WhenIdle, 54
  4574.  WhereX, 55
  4575.  WhereY, 55
  4576.  While, 13
  4577.  Width, 8
  4578.  Write, 7, 56
  4579.  
  4580.  X
  4581.  
  4582.  XonXoff, 48
  4583.  
  4584.  Z
  4585.  
  4586.  zASCII, 48
  4587.  zAutoDownload, 48
  4588.  zRecovery, 48
  4589.  
  4590.  
  4591.