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