home *** CD-ROM | disk | FTP | other *** search
/ The Education Master 1994 (4th Edition) / EDUCATIONS_MASTER_4TH_EDITION.bin / files / commadio / telmt23 / tmscript.doc < prev    next >
Text File  |  1992-06-23  |  164KB  |  4,569 lines

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