home *** CD-ROM | disk | FTP | other *** search
/ 98 Driver Collection MD-0164 / DRIVER_KING_98.iso / MODEM / TELIX3.5 / CSS.DOC < prev    next >
Encoding:
Text File  |  1996-01-21  |  52.4 KB  |  1,684 lines

  1.  
  2.  
  3.      T E L I X
  4.  
  5.      ────────────────────────────────────────────────────────────
  6.  
  7.      SIMPLE Programming Manual
  8.  
  9.  
  10.  
  11.  
  12.  
  13.                Copyright (C) 1986-95 deltaComm Development
  14.                Copyright (C) 1994-95 ELSA GmbH, Aachen, Germany
  15.          
  16.                ALL RIGHTS RESERVED.
  17.  
  18.  
  19.                           ELSA GmbH
  20.                           Sonnenweg 11
  21.                           52070 Aachen
  22.                           Germany
  23.  
  24.                           Phone +49/0-241-9177-0
  25.                           Fax   +49/0-241-9177-600
  26.                           Modem +49/0-241-9177-981
  27.                           ISDN  +49/0-241-9177-7800
  28.             
  29.  
  30.  
  31.  
  32.                              Copyright Notice
  33.  
  34.  
  35.      Telix, SALT, and SIMPLE Copyright (C) 1986-95 by deltaComm 
  36.      Development, and 1988-95 by ELSA GmbH - All rights reserved.
  37.  
  38.      No parts of Telix or this document may be copied in part or in whole,
  39.      except as provided in the License in the following pages.
  40.  
  41.  
  42.  
  43.      Disclaimer
  44.  
  45.      deltaComm Development and ELSA GmbH make no warranty of any kind, 
  46.      either express or implied, including but not limited to implied 
  47.      warranties of merchantability and fitness for a particular purpose, 
  48.      with respect to this software and accompanying documentation.
  49.  
  50.      IN NO EVENT SHALL DELTACOMM DEVELOPMENT AND ELSA GMBH BE LIABLE FOR 
  51.      ANY DAMAGES (INCLUDING DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS
  52.      INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
  53.      ARISING OUT OF THE USE OF OR INABILITY TO USE THIS PROGRAM, EVEN IF
  54.      DELTACOMM DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  55.      DAMAGES.
  56.  
  57.  
  58.  
  59.      Trademarks
  60.  
  61.      Telix is a trademark of deltaComm Development.
  62.      SIMPLE is a trademark of deltaComm Development.
  63.      SALT is a trademark of deltaComm Development.
  64.  
  65.      Many product names found throughout this manual are trademarks of
  66.      various companies.
  67.  
  68.  
  69.      
  70.      Version Info
  71.  
  72.      This documentation applies to
  73.  
  74.      Telix version 3.50 
  75.      CSS   version 3.5
  76.  
  77.  
  78.  
  79.  
  80.      Aachen, July 1995
  81.  
  82.  
  83.      ──────────────────────────────────────────────────────────────────────
  84.  
  85.  
  86.  
  87.  
  88.                                C O N T E N T S
  89.  
  90.  
  91.  
  92.      1.  The Telix SIMPLE Language
  93.          1.1  What Can Be Accomplished With Simple?
  94.          1.2  Comparing SIMPLE to SALT
  95.          1.3  Creating SIMPLE Scripts
  96.  
  97.      2.  Syntax
  98.  
  99.      3.  Program Structure
  100.          3.1  Variables
  101.          3.2  System Variables
  102.  
  103.      4.  Built-in Functions
  104.  
  105.      5.  Program Control
  106.          5.1  The Waitfor Command
  107.          5.2  The If Command
  108.          5.3  The Whenever Loop
  109.  
  110.  
  111.      ──────────────────────────────────────────────────────────────────────
  112.  
  113.  
  114.  
  115.  
  116.      1.  The Telix SIMPLE Language
  117.  
  118.  
  119.      Telix has a built-in programming language called SALT (Script
  120.      Application Language for Telix).  SALT is extremely powerful, and much
  121.      of that power is due to its semblance to the C programming language.
  122.      Along with that power comes a degree of difficulty, however.  For
  123.      those not comfortable in a structured programming environment such as
  124.      SALT, a second scripting language, SIMPLE (Salt IMPLEmentation) is
  125.      also provided.
  126.  
  127.      Simple takes a loosely structured program resembling a stream of
  128.      English sentences and transforms it into SALT for you. No programming
  129.      experience is necessary.  It's SIMPLE!
  130.  
  131.  
  132.  
  133.      1.1  What Can Be Accomplished With Simple?
  134.      ──────────────────────────────────────────────────────────────────────
  135.  
  136.      SIMPLE scripts can be used to automate logins to bulletin boards,
  137.      automate repetitive tasks such as mail transfers, or can be programmed
  138.      to watch for multiple strings, offering up the proper response to each
  139.      no matter the order in which they arrive.  SIMPLE offers you much of
  140.      the power of SALT without the learning curve.
  141.  
  142.  
  143.  
  144.      1.2  Comparing SIMPLE to SALT
  145.      ──────────────────────────────────────────────────────────────────────
  146.  
  147.      SALT's complexity allows it to do much more than SIMPLE can.  For
  148.      example, the Host+ bulletin board that comes with Telix was written
  149.      primarily in SALT, but such a task would not be possible in SIMPLE.
  150.      SALT offers access to most screen-related functions in Telix; SIMPLE
  151.      offers only a pair of commands to place information on the screen.
  152.      SALT offers full color control; SIMPLE does not.  Other differences
  153.      make SALT the preferable language for complex scripts.
  154.  
  155.      If your copy of Telix is registered, the SIMPLE compiler, CSS can
  156.      leave a copy of the translated script on your hard drive in SALT
  157.      source format.  SIMPLE is primarily a tool for helping you to master
  158.      SALT, and study of these translations are an excellent way to get
  159.      started.
  160.  
  161.  
  162.  
  163.      1.3  Creating SIMPLE Scripts
  164.      ──────────────────────────────────────────────────────────────────────
  165.  
  166.      A SIMPLE script is basically a sequence of instructions for Telix to
  167.      follow, using a loosely defined syntax.  You may use any text editor
  168.      to produce this script file, as long as its output is normal ASCII
  169.      text (this means that if you use your word processor, you must
  170.      explicitly tell it to write out the file using ASCII format and not to
  171.      embed any special codes in the file).  You may give any name you wish
  172.      to a SIMPLE script, although we recommend that you always use the
  173.      extension .SIM for clarity.  For example, a script to log on to the
  174.      Telix Support BBS might be called TELIX.SIM.
  175.  
  176.      Once you have written your script file and saved it to disk, it must 
  177.      be compiled.  The program CSS.EXE included with Telix reads your 
  178.      "source" script and compiles it into a form which Telix can understand.  
  179.      The compiled script can be loaded more quickly by Telix, and is also
  180.      smaller.
  181.  
  182.      To compile a SIMPLE script file, start the compiler as follows:
  183.  
  184.           CSS [-D] [-S] <srcfile> [<dstfile>]
  185.  
  186.      Parameters in brackets are optional. The -D parameter causes the 
  187.      compiler to delay after reporting an error. The -S parameter tells the
  188.      compiler to show the current status during the compilation.
  189.  
  190.      <srcfile> is the name of the script we are trying to compile, and
  191.      <dstfile> is the optional name of the compiled script to create. CSS 
  192.      knows the naming conventions of Telix, and expects that an input file 
  193.      ends in .SIM and an output file ends in .SLC, so you may simply type:
  194.  
  195.           CSS ELSA ELSA
  196.  
  197.      If you do not supply a destination name, CSS assumes the output name 
  198.      is the input name followed by .SLC.  The simplest way to compile
  199.      ELSA.SIM is therefore:
  200.  
  201.           CSS ELSA
  202.  
  203.      You can also compile a SIMPLE script from within Telix by selecting
  204.      the "Compile" command from the "Script" menu or pressing Ctrl-F9 and
  205.      entering the filename of the script with the extension .SIM.  The
  206.      extension must be exressly supplied, because otherwise Telix would
  207.      look for a SALT script with the extension .SLT.
  208.  
  209.      When the script compiler finds an error in your source file, it will
  210.      abort the compile process and give you the line number on which the
  211.      error occurred, as well as the type of error.  The error should then
  212.      be fixed and the source recompiled.  This is repeated until the
  213.      compiled detects no more errors in your script file.
  214.  
  215.      The compiled script can then be run in Telix using several methods.
  216.      It may be run using the 'Run Script' command, as a command line
  217.      parameter to Telix, as a linked script to a dialing directory entry
  218.      (i.e. automatically, when you connect to a system), or from another
  219.      script.  The first three methods are described in the Telix manual,
  220.      while the last is described later in this manual.
  221.  
  222.  
  223.      ──────────────────────────────────────────────────────────────────────
  224.  
  225.  
  226.  
  227.  
  228.      2.  Syntax
  229.  
  230.  
  231.      Case is not important in command, function, and variable names. The
  232.      only time case matters is inside a string constant (e.g., "Hello" is
  233.      not the same string as "hello"). Whitespace (such as the space, the
  234.      tab, the Carriage Return, or the Line Feed character) is not impor-
  235.      tant. The script compiler does not care where you place items, so that
  236.      you may arrange the program as you see fit. For example,
  237.  
  238.           If Online Then Send String25
  239.           Else Dial "11" MaxOf 23 RunScript
  240.  
  241.      is equivalent to
  242.  
  243.           If Online Then
  244.             Send String25
  245.           Else
  246.             Dial "11" MaxOf 23 RunScript
  247.  
  248.      or even to
  249.  
  250.           If
  251.           Online
  252.           Then
  253.           Send
  254.           String25
  255.           Else
  256.           Dial
  257.           "11"
  258.           MaxOf
  259.           23
  260.           RunScript
  261.  
  262.      The only time whitespace matters is when it would split up key-words
  263.      or function name, or in a string. For example, the key-word 'whenever'
  264.      must not be split up if it is to be recognized. The same applies to
  265.      other key-words or function names. As well, there must be space be-
  266.      tween the letters of a command and other letters. For example,
  267.      'whenever' is not the same as 'wheneverabc'. In the interest of
  268.      clarity, it is recommended that you try to make your script easy to
  269.      understand, by indenting where appropriate, and by using space ef-
  270.      fectively. There is no reason, for example, to put more than one
  271.      statement on a line, even if it is perfectly legal. Another poor
  272.      example above, however, is one where a complete line is broken up for
  273.      no good reason.  A good example of program style can be found by
  274.      looking at the sample SIMPLE scripts included with Telix.
  275.  
  276.      A string constant is a sequence of ASCII characters enclosed in
  277.      quotes, for example, "Hello", "Good-bye", or "Telix".  String
  278.      constants and their use are discussed later.
  279.  
  280.  
  281.      ──────────────────────────────────────────────────────────────────────
  282.  
  283.  
  284.  
  285.  
  286.      3.  Program Structure
  287.  
  288.      A SIMPLE script has no set format beyond a few easy-to-follow rules.
  289.      These rules will be discussed as the apply to the individual commands
  290.      when necessary.  Otherwise, simply add commands to your script to do
  291.      whatever is necessary.
  292.  
  293.      It is highly recommended that you read this manual sequentially, as
  294.      each command builds on the last.  By the end of the manual we will
  295.      have worked into more complex examples, and will actually construct a
  296.      script to log on to the Telix Support BBS.
  297.  
  298.  
  299.  
  300.      3.1  Variables
  301.      ──────────────────────────────────────────────────────────────────────
  302.  
  303.      A SIMPLE script may use up to 255 string "variables", or groups of
  304.      characters that you can change as you see fit.  You need not do
  305.      anything special to use a string.  Just use the word "StringXX"
  306.      wherever you need the string, where XX is the number the string.  All
  307.      SIMPLE strings are exactly 80 characters in length.  These will be
  308.      referred to as StringXX variables throughout this documentation.
  309.      Examples of StringXX use might be as follows:
  310.  
  311.      To create string number 20, and make it contain the phone number of
  312.      the Telix BBS, you might have a line:
  313.  
  314.      Assign String20, "1-919-481-9399"
  315.  
  316.      Note that you do not have to use all 80 characters of a string.
  317.      SIMPLE knows where to end a string if you don't fill it up.
  318.  
  319.      To create a string that contains today's date, you could simply use:
  320.  
  321.      Date String15
  322.  
  323.      If you need to use either the quote character itself in a string, or
  324.      the carat symbol (the shifted-6), both have special meaning in Telix,
  325.      and must be dereferenced.  To dereference the character, precede it
  326.      with a carat.  Examples of this are:
  327.  
  328.      Assign String1, "A quote, ^", needs a carat in front."
  329.  
  330.      Assign String2, "A carat, ^^, is represented by two carats."
  331.  
  332.      
  333.      Integer variables are also available, referred to as IntegerXX 
  334.      variables, and conform to the same rules as StringXX variables.  
  335.      IntegerXX can contain values ranging from -2,147,483,683 to
  336.      2,147,483,648.
  337.      
  338.  
  339.  
  340.      3.2  System Variables
  341.      ──────────────────────────────────────────────────────────────────────
  342.  
  343.      SIMPLE has four system variables which may be used as part of certain
  344.      statements.  Their use will be explained in greater detail as part of
  345.      the commands that may access them.  These variables are:
  346.  
  347.      BBSNumber:     This variable will contain the dialing directory entry
  348.                     number after dialing and connecting to a system.  It
  349.                     changes only when a connection is made.
  350.  
  351.      TransferStatus:This variable will contain the result code of a file
  352.                     transfer performed in SIMPLE. The values of these
  353.                     results will be explained later in the documentation as
  354.                     part of file transfers.
  355.  
  356.      ReturnCode:    This variable is explained in detail under the If
  357.                     directive in chapter 5.
  358.  
  359.      BBSPassword:   This variable contains your password for the system you
  360.                     last connected to, as read from the dialing directory.
  361.                     This variable makes it possible to write a script that
  362.                     doesn't have to be recompiled every time you change
  363.                     your password.  The script can just use this variable
  364.                     instead of a String variable.  All you need to do when
  365.                     changing your password is to edit the dialing directory
  366.                     within Telix, and insert the new password.
  367.  
  368.  
  369.      ──────────────────────────────────────────────────────────────────────
  370.  
  371.  
  372.  
  373.  
  374.      4.  Built-in Functions
  375.  
  376.  
  377.  
  378.      ADD
  379.      ──────────────────────────────────────────────────────────────────────
  380.  
  381.      ■  Summary
  382.  
  383.      ADD <Integer1>, <Integer2>
  384.  
  385.      ■  Description
  386.  
  387.      The ADD function adds the value of <Integer2> to <Integer1> and stores
  388.      the result in <Integer1>.  Neither integer need be defined prior to an
  389.      ADD.  The first value must be an IntegerXX variable, and the second 
  390.      value may be either a variable or a literal value.  The comma between 
  391.      the two values is required.
  392.  
  393.      ■  See also
  394.  
  395.      Assign, DIV, MUL, SUB
  396.  
  397.      ■  Example
  398.  
  399.      Assign Integer30, 50
  400.      ADD Integer30, 25
  401.      ADD Integer30, Integer30
  402.  
  403.  
  404.  
  405.      ADDSTRING
  406.      ──────────────────────────────────────────────────────────────────────
  407.  
  408.      ■  Summary
  409.  
  410.      AddString <String1>, <String2>
  411.  
  412.      ■  Description
  413.  
  414.      The AddString function adds, or concatenates, the value of <String2> 
  415.      to <String1> and stores the result in <String1>.  <String1> must be a 
  416.      StringXX variable, and <String2> may be either literal string in 
  417.      quotes or a StringXX variable.  The comma between the two strings is 
  418.      required.
  419.  
  420.      ■  See also
  421.  
  422.      Assign
  423.  
  424.      ■  Example
  425.  
  426.      Assign String1, "TELIX"
  427.      AddString String1, ".FON"
  428.  
  429.  
  430.  
  431.      ALARM
  432.      ──────────────────────────────────────────────────────────────────────
  433.  
  434.      ■  Summary
  435.  
  436.      Alarm <integer>
  437.  
  438.      ■  Description
  439.  
  440.      The Alarm function causes an alarm sound (similar to the connect alarm
  441.      of Telix) to ring for <integer> seconds.
  442.  
  443.      ■  Example
  444.  
  445.      Alarm 5
  446.  
  447.  
  448.  
  449.      ASSIGN
  450.      ──────────────────────────────────────────────────────────────────────
  451.  
  452.      ■  Summary
  453.  
  454.      Assign <String1>, <String2>
  455.  
  456.      Assign <Integer1>, <Integer2>
  457.  
  458.      ■  Description
  459.  
  460.      The Assign function assigns the value of <String2> to <String1>, or 
  461.      the value of <Integer2> to <Integer1>. Neither string, or integer,
  462.      need be defined prior to an assign.  The first value must be a 
  463.      StringXX, or IntegerXX, variable, and the second value may be either  
  464.      a variable or a literal value.  The comma between the two values is 
  465.      required.
  466.  
  467.      ■  See also
  468.  
  469.      AddString, ADD, DIV, MUL, SUB
  470.      
  471.      ■  Examples
  472.  
  473.      Assign String24, "ELSA ONLINE"
  474.      Assign String40, String24
  475.  
  476.      Assign Integer30, 500
  477.      Assign Integer35, Integer30
  478.  
  479.  
  480.  
  481.      BEGIN
  482.      ──────────────────────────────────────────────────────────────────────
  483.  
  484.      ■  Summary
  485.  
  486.      Begin
  487.  
  488.      ■  Description
  489.  
  490.      The Begin command denotes the start of a group of code that belongs
  491.      together.  It is typically used to keep a group of code together in
  492.      conjunction with If statements (see If).  Every Begin command must
  493.      have a corresponding End command.  Begin and End commands may be
  494.      nested within each other.
  495.  
  496.      It is recommended that indentation be used to help keep track of the
  497.      Begin and End pairs.
  498.  
  499.      ■  See also
  500.  
  501.      End
  502.  
  503.      ■  Example
  504.  
  505.      if Online then
  506.        Begin
  507.          Assign String4, "TELIX.REP"
  508.          Alarm 3
  509.        End
  510.  
  511.  
  512.      The use of the If statement will be discussed shortly.  The example
  513.      above is primarily to illustrate the Begin and End pairs.
  514.  
  515.  
  516.  
  517.      CAPTURELOG
  518.      ──────────────────────────────────────────────────────────────────────
  519.  
  520.      ■  Summary
  521.  
  522.      CaptureLog (<String>/Off/On/Pause/Unpause)
  523.  
  524.      ■  Description
  525.  
  526.      The CaptureLog function controls the status of the Telix Capture file,
  527.      in much the same was as Alt-L does from the keyboard in Telix.  You
  528.      may turn on the capture log by passing a StringXX or constant string,
  529.      pause, unpause, or turn off the capture file entirely.  Only one of
  530.      these actions may be performed per CaptureLog command.  CaptureLog On
  531.      opens the capture log to the default Telix log name.
  532.  
  533.      ■  Examples
  534.  
  535.      CaptureLog "TEMP.CAP"
  536.      CaptureLog Pause
  537.      CaptureLog Unpause
  538.      CaptureLog Off
  539.  
  540.      CaptureLog On
  541.      CaptureLog Off
  542.  
  543.      Assign String16, "TELIX.CAP"
  544.      CaptureLog String16
  545.      CaptureLog Off
  546.  
  547.  
  548.  
  549.      CHANGEDIR
  550.      ──────────────────────────────────────────────────────────────────────
  551.  
  552.      ■  Summary
  553.  
  554.      ChangeDir <String>
  555.  
  556.      ■  Description
  557.  
  558.      The ChangeDir function provides access to the DOS "CD" command.  You
  559.      may change to any valid directory with this command.  Invalid
  560.      directories are simply ignored, and Telix will remain in the current
  561.      directory.  <String> may be either a StringXX variable or a literal
  562.      string in quotes.
  563.  
  564.      ■  Examples
  565.  
  566.      Assign String64, "D:\TELIX\DOWN"
  567.      ChangeDir String64
  568.      ChangeDir "C:\TELIX"
  569.  
  570.  
  571.  
  572.      CLEARSCREEN
  573.      ──────────────────────────────────────────────────────────────────────
  574.  
  575.      ■  Summary
  576.  
  577.      ClearScreen
  578.  
  579.      ■  Description
  580.  
  581.      The ClearScreen function acts as if you had pressed Alt-C from within
  582.      Telix.  It clears the screen of all characters other than the status
  583.      line (if on).  ClearScreen does not accept any parameters.
  584.  
  585.      ■  Example
  586.  
  587.      ClearScreen
  588.  
  589.  
  590.  
  591.      CURSOR
  592.      ──────────────────────────────────────────────────────────────────────
  593.  
  594.      ■  Summary
  595.  
  596.      Cursor (On/Off)
  597.  
  598.      ■  Description
  599.  
  600.      The Cursor function turns the text cursor in the terminal screen on or
  601.      off.
  602.  
  603.      ■  Examples
  604.  
  605.      Cursor On
  606.      
  607.      Cursor Off
  608.  
  609.  
  610.  
  611.      DATE
  612.      ──────────────────────────────────────────────────────────────────────
  613.  
  614.      ■  Summary
  615.  
  616.      Date <String>
  617.  
  618.      ■  Description
  619.  
  620.      The Date function places the current date into <String>.  <String>
  621.      must be a StringXX-type variable.
  622.  
  623.      ■  Example
  624.  
  625.      Date String16
  626.  
  627.  
  628.  
  629.      DIAL
  630.      ──────────────────────────────────────────────────────────────────────
  631.  
  632.      ■  Summary
  633.  
  634.      dial <String> [From <String>] [MaxOf <Integer>] [RunScript]
  635.  
  636.      ■  Description
  637.  
  638.      The Dial function allows nearly complete access to the Telix dialing
  639.      directory.  Telix can be told to dial several entries, or from a
  640.      specific dialing directory, and can be told whether or not to run a
  641.      linked script.
  642.  
  643.      Dial must be passed at least one parameter, a StringXX variable or
  644.      string constant in quotes containing numbers to dial.  This string may
  645.      contain either a list of entries by number, or a manual number
  646.      preceded with a lowercase "m".
  647.  
  648.      If you wish, you may tell Dial from which directory these numbers are
  649.      to be read, with an optional From directive.  From must be passed a
  650.      StringXX or literal string constant in quotes, containing the name of
  651.      the directory to load.  If you use a From directive, it will be valid
  652.      throughout the rest of the script.  To avoid confusion, it is best to
  653.      either always use From, or never use it.  If From is not used, the
  654.      currently loaded  directory shall be the source.
  655.  
  656.      You may tell Telix to limit the number of dialing attempts to make by
  657.      using an optional MaxOf directive.  MaxOf must be followed by an
  658.      integer number of attempts to make.  MaxOf must come after From if
  659.      From is present.
  660.  
  661.      You may tell Telix to execute the script linked to the dialing
  662.      directory.  The default is not to execute such a script.  By placing
  663.      the optional directive RunScript at the end of the Dial command, Telix
  664.      will execute that linked script, and return control to your SIMPLE
  665.      script upon completion.
  666.  
  667.      ■  Return Value
  668.  
  669.      The Dial function places a return value into the system variable
  670.      ReturnCode as follows:
  671.  
  672.      If there was a connection, ReturnCode shall be the entry number in the
  673.      dialing directory of the system connected to (or 1 for a manual
  674.      number).
  675.  
  676.      If there was no connection established, a zero shall be placed into
  677.      ReturnCode.
  678.  
  679.      If the string passed to dial did not contain a string that dial could
  680.      interpret as a valid list of numbers to dial, -1 will be placed into
  681.      ReturnCode.
  682.  
  683.      The use of the ReturnCode is discussed in detail as part of the If
  684.      statement.
  685.  
  686.      ■  Examples
  687.  
  688.      The first example dials entries 1, 5, and 6 from LONGDIST.FON until it
  689.      connects to one of them or the user presses escape.
  690.  
  691.      The second example dials the Telix Support BBS manually, up to 50
  692.      times.
  693.  
  694.      The third example dials entries 1, 5, and 6, after loading TELIX.FON.
  695.      If a connection is made, any script linked to the entry will be
  696.      executed.
  697.  
  698.      Assign String24, "1 5 6"
  699.      Assign String64, "D:\TELIX\FON\LONGDIST.FON"
  700.  
  701.      Dial String24 From String64
  702.  
  703.      Dial "m1-919-481-9399" MaxOf 50
  704.  
  705.      Dial String24 From "TELIX.FON" RunScript
  706.  
  707.  
  708.  
  709.      DIV
  710.      ──────────────────────────────────────────────────────────────────────
  711.  
  712.      ■  Summary
  713.  
  714.      DIV <Integer1>, <Integer2>
  715.  
  716.      ■  Description
  717.  
  718.      The DIV function divides the value of <Integer1> by <Integer2> and 
  719.      stores the result in <Integer1>.  Neither integer need be defined 
  720.      prior to a DIV.  The first value must be an IntegerXX variable, and 
  721.      the second value may be either a variable or a literal value.  The 
  722.      comma between the two values is required.
  723.  
  724.      ■  See also
  725.  
  726.      Assign, ADD, MUL, SUB
  727.  
  728.      ■  Example
  729.  
  730.      Assign Integer30, 50
  731.      DIV Integer30, 2
  732.      
  733.  
  734.  
  735.      DOS
  736.      ──────────────────────────────────────────────────────────────────────
  737.  
  738.      ■  Summary
  739.  
  740.      Dos <String> [Pause]
  741.  
  742.      ■  Description
  743.  
  744.      The Dos function allows you to shell to DOS to execute the program
  745.      specified in <String>.  <String> may be a StringXX variable or a
  746.      literal string in quotes.  If you wish Telix to pause prior to
  747.      returning, simply place the optional directive Pause after the command
  748.      to execute.
  749.  
  750.      ■  Return Value
  751.  
  752.      The value that SIMPLE returns after running the command is placed in 
  753.      the system variable ReturnCode.  Use of the ReturnCode is discussed 
  754.      with the If statement. A return value of -1 means that the DOS command 
  755.      processor was not found or there is not enough memory to load it. If 
  756.      all goes well, a value of 0 is returned.
  757.  
  758.      ■  Examples
  759.  
  760.      Assign String64, "C:\WP51\WP.EXE"
  761.      Dos String64
  762.      Dos "D:\UTIL\QEDIT.EXE" PauseScreen
  763.  
  764.  
  765.  
  766.      DOWNLOAD
  767.      ──────────────────────────────────────────────────────────────────────
  768.  
  769.      ■  Summary
  770.  
  771.      Download <String> [With Protocol]
  772.  
  773.      ■  Description
  774.  
  775.      The Download function acts just as if you had pressed PgDn and entered
  776.      a protocol and filename.  It will download the file (or files if a
  777.      batch protocol is used) indicated by <String>.  <String> may be a
  778.      StringXX variable or a string constant in quotes.
  779.  
  780.      The Download command uses the protocol specified by the With
  781.      directive.  If no protocol is specified, Telix will prompt for the
  782.      protocol. Protocols allowed following the With directive are:
  783.  
  784.                          Kermit
  785.                          Modem7
  786.                          SeaLink
  787.                          Telink
  788.                          Xmodem
  789.                          1K-Xmodem
  790.                          G-1K-Xmodem
  791.                          Ymodem
  792.                          Ymodem-G
  793.                          Zmodem
  794.  
  795.      External protocols are not available from SIMPLE.
  796.  
  797.      Remember that downloads usually need to be triggered on the remote
  798.      site before you can receive the file.  You will usually need to Send a
  799.      start command prior to using the Download command.  The Send command
  800.      is described elsewhere in this manual.
  801.  
  802.      ■  Examples
  803.  
  804.      Assign String64, "D:\TELIX\DOWN\WORK\TELIX.QWK"
  805.  
  806.      Send "D;Z" Enter
  807.      Send Enter
  808.      Download String64 with Zmodem
  809.  
  810.      Send "D;G" Enter
  811.      Send Enter
  812.      Download "C:\TELIX\DOWN\TLX320-1.ZIP" With Ymodem-G
  813.  
  814.  
  815.  
  816.      EMULATE
  817.      ──────────────────────────────────────────────────────────────────────
  818.  
  819.      ■  Summary
  820.  
  821.      Emulate <Protocol>
  822.  
  823.      ■  Description
  824.  
  825.      The Emulate function tells Telix to change the terminal emulation it
  826.      is using to that specified by <Protocol>.  Allowable Emulations that
  827.      can be passed to the Emulate command are:
  828.  
  829.                          TTY
  830.                          ANSI-BBS
  831.                          VT52
  832.                          VT102
  833.                          ANSI
  834.                          AVATAR
  835.  
  836.      ■  Examples
  837.  
  838.      Emulate VT102
  839.      Emulate ANSI-BBS
  840.  
  841.      
  842.      
  843.      END
  844.      ──────────────────────────────────────────────────────────────────────
  845.  
  846.      ■  Summary
  847.  
  848.      End
  849.  
  850.      ■  Description
  851.  
  852.      The End command denotes the end of a group of code that belongs
  853.      together.  It is typically used to keep a group of code together in
  854.      conjunction with If statements (see If).  Every End command must have
  855.      a preceding Begin command.  Begin and End commands may be nested
  856.      within each other.
  857.  
  858.      It is recommended that indentation be used to help keep track of the
  859.      Begin and End pairs.
  860.  
  861.      ■  Example
  862.  
  863.      if Online then
  864.        Begin
  865.          Send "U" Enter
  866.          Upload "TELIX.REP" with Zmodem
  867.        End
  868.  
  869.  
  870.  
  871.      ERASEFILE
  872.      ──────────────────────────────────────────────────────────────────────
  873.  
  874.      ■  Summary
  875.  
  876.      EraseFile <String>
  877.  
  878.      ■  Description
  879.  
  880.      The EraseFile function deletes the file specified in <String> from the
  881.      disk.  Be careful using this command as deleted files are usually
  882.      unrecoverable.  <String> may be a StringXX variable or a literal
  883.      string in quotes.
  884.  
  885.      ■  Example
  886.  
  887.      Assign String24, "D:\WINDOWS\TELIX.TTF"
  888.      EraseFile String24
  889.      EraseFile "C:\TELIX\QWIK\TELIX.QWK"
  890.  
  891.  
  892.  
  893.      EXITSCRIPT
  894.      ──────────────────────────────────────────────────────────────────────
  895.  
  896.      ■  Summary
  897.  
  898.      ExitScript
  899.  
  900.      ■  Description
  901.  
  902.      The ExitScript function halts execution of the script.  It is exactly
  903.      like pressing Escape while a script is running, and answering "Yes".
  904.  
  905.      ■  Example
  906.  
  907.      ExitScript
  908.  
  909.  
  910.  
  911.      EXITTELIX
  912.      ──────────────────────────────────────────────────────────────────────
  913.  
  914.      ■  Summary
  915.  
  916.      ExitTelix
  917.  
  918.      ■  Description
  919.  
  920.      The ExitTelix function halts execution of the script, and exits Telix
  921.      altogether.  It is exactly like pressing Alt-X and answering "Yes."
  922.  
  923.      ■  Example
  924.  
  925.      ExitTelix
  926.   
  927.  
  928.  
  929.      HANGUP
  930.      ──────────────────────────────────────────────────────────────────────
  931.  
  932.      ■  Summary
  933.  
  934.      Hangup
  935.  
  936.      ■  Description
  937.  
  938.      The Hangup function disconnects you from any system you might be
  939.      connected to at the time.  It is exactly like pressing Alt-H from
  940.      within Telix.
  941.  
  942.      ■  Example
  943.  
  944.      Hangup
  945.  
  946.  
  947.  
  948.      INPUT
  949.      ──────────────────────────────────────────────────────────────────────
  950.  
  951.      ■  Summary
  952.  
  953.      Input <StringXX>, Nx
  954.  
  955.      ■  Description
  956.  
  957.      The Input function gets up Nx characters from the keyboard and places
  958.      them into <StringXX>.  Nx is any integer value from 1 to 80, and
  959.      <StringXX> must be a StringXX-type variable.
  960.  
  961.      No prompting is made by SIMPLE.  If you wish to prompt the user for
  962.      the data, you will want to put the prompt up yourself, using the Show
  963.      command, described later.
  964.  
  965.      An example of the Input routine below allows the user to input up to
  966.      40 characters, placing them into String22:
  967.  
  968.      ■  Example
  969.  
  970.      Input String22, 40
  971.  
  972.  
  973.  
  974.      MESSAGE
  975.      ──────────────────────────────────────────────────────────────────────
  976.  
  977.      ■  Summary
  978.  
  979.      Message <String>
  980.  
  981.      ■  Description
  982.  
  983.      The Message command places <String> into a centered box on the screen
  984.      for exactly three seconds.  It is very much like what you would see in
  985.      Telix when pressing Alt-E, for example, but it allows you to specify
  986.      the message in the box.  <String> may be a StringXX variable or a
  987.      literal string in quotes.
  988.  
  989.      ■  Example
  990.  
  991.      Message "Disconnecting from the Telix Support BBS"
  992.  
  993.  
  994.  
  995.      MUL
  996.      ──────────────────────────────────────────────────────────────────────
  997.  
  998.      ■  Summary
  999.  
  1000.      MUL <Integer1>, <Integer2>
  1001.  
  1002.      ■  Description
  1003.  
  1004.      The MUL function multiplies the value of <Integer1> by <Integer2> and 
  1005.      stores the result in <Integer1>.  Neither integer need be defined 
  1006.      prior to a MUL.  The first value must be an IntegerXX variable, and 
  1007.      the second value may be either a variable or a literal value.  The 
  1008.      comma between the two values is required.
  1009.  
  1010.      ■  See also
  1011.  
  1012.      Assign, ADD, DIV, SUB
  1013.  
  1014.      ■  Example
  1015.  
  1016.      Assign Integer30, 25
  1017.      MUL Integer30, 2
  1018.      
  1019.  
  1020.  
  1021.      PRINTER
  1022.      ──────────────────────────────────────────────────────────────────────
  1023.  
  1024.      ■  Summary
  1025.  
  1026.      Printer [On] [Off]
  1027.  
  1028.      ■  Description
  1029.  
  1030.      The Printer command toggles the printer mode on and off, just as Ctrl-
  1031.      @ does in Telix.  You must specify the state you wish the log to be
  1032.      in, On or Off.
  1033.  
  1034.      ■  Example
  1035.  
  1036.      Printer On
  1037.  
  1038.      Printer Off
  1039.  
  1040.  
  1041.  
  1042.      RENAMEFILE
  1043.      ──────────────────────────────────────────────────────────────────────
  1044.  
  1045.      ■  Summary
  1046.  
  1047.      RenameFile <String1>, <String2>
  1048.  
  1049.      ■  Description
  1050.  
  1051.      The RenameFile function renames the file specified in <String1> to the
  1052.      filename specified in <String2>.  Either string may be a StringXX 
  1053.      variable or a literal string in quotes.
  1054.  
  1055.      ■  See Also
  1056.  
  1057.      EraseFile
  1058.  
  1059.      ■  Example
  1060.  
  1061.      Assign String24, "C:\TELIX\QWK\TELIX.QWK"
  1062.      RenameFile String24, "C:\TELIX\QWK\TELIX.BAK"
  1063.      
  1064.      
  1065.  
  1066.      RUNSCRIPT
  1067.      ──────────────────────────────────────────────────────────────────────
  1068.  
  1069.      ■  Summary
  1070.  
  1071.      RunScript <String>
  1072.  
  1073.      ■  Description
  1074.  
  1075.      The RunScript function loads the script specified in <String> and
  1076.      executes it.  When this new script terminates, your script will
  1077.      continue from this position.  <String> may be either a StringXX
  1078.      variable or a literal string in quotes.
  1079.  
  1080.      ■  Return Value
  1081.  
  1082.      RunScript places the value returned by the called script into the
  1083.      system variable ReturnCode. All SIMPLE scripts will return a zero.
  1084.      SALT scripts may return varying values.
  1085.  
  1086.      ■  Example
  1087.  
  1088.      RunScript "AXSTOOLS.SLC"
  1089.  
  1090.  
  1091.  
  1092.      SEND
  1093.      ──────────────────────────────────────────────────────────────────────
  1094.  
  1095.      ■  Summary
  1096.  
  1097.      Send <String> [Enter]
  1098.  
  1099.      ■  Description
  1100.  
  1101.      The Send function sends the data contained in <String> out the comm
  1102.      port, and also to the screen.  If the keyword Enter follows <String>
  1103.      then a carriage return will be sent as well.  <String> may be a
  1104.      StringXX variable or a string constant in quotes.
  1105.  
  1106.      ■  Examples
  1107.  
  1108.      Assign String14, "Telix Support"
  1109.  
  1110.      Send String14
  1111.      Send "Chatting with Sysop" Enter
  1112.  
  1113.  
  1114.  
  1115.      SHELL
  1116.      ──────────────────────────────────────────────────────────────────────
  1117.  
  1118.      ■  Summary
  1119.  
  1120.      Shell
  1121.  
  1122.      ■  Description
  1123.  
  1124.      The Shell function jumps to MS-DOS and allows you to execute other
  1125.      programs manually.  This is the same as pressing Alt-J within Telix.
  1126.      To return to your script from DOS, simply type "exit" at the DOS
  1127.      prompt.
  1128.  
  1129.      You must return to the directory you started in if things are expected
  1130.      to function properly.  If you "exit" back to Telix while in another
  1131.      directory, the current directory that scripts use will be incorrect
  1132.      and files might not be found where they should be.  Be careful using
  1133.      the Shell command.
  1134.  
  1135.      ■  Example
  1136.  
  1137.      Shell
  1138.  
  1139.  
  1140.  
  1141.      SHOW
  1142.      ──────────────────────────────────────────────────────────────────────
  1143.  
  1144.      ■  Summary
  1145.  
  1146.      Show <String> [Enter]
  1147.  
  1148.      ■  Description
  1149.  
  1150.      The Show function places the data contained in <String> on the screen.
  1151.      If the keyword Enter follows <String> then a carriage return will be
  1152.      displayed as well.  <String> may be a StringXX variable or a string
  1153.      constant in quotes.
  1154.  
  1155.      Show is very similar to Send, but the data is not sent over the comm
  1156.      port.  Be careful not to confuse Show and Send.
  1157.  
  1158.      ■  Examples
  1159.  
  1160.      Assign String14, "Telix Support"
  1161.  
  1162.      Show String14
  1163.      Show "Chatting with Sysop" Enter
  1164.  
  1165.  
  1166.  
  1167.      SOUND
  1168.      ──────────────────────────────────────────────────────────────────────
  1169.  
  1170.      ■  Summary
  1171.  
  1172.      Sound Nx, Ny
  1173.  
  1174.      ■  Description
  1175.  
  1176.      The Sound function causes tone of frequency (pitch) Nx to be played on
  1177.      the PC speaker for Ny tenths of a second.  You may want to experiment
  1178.      with values for Nx to determine acceptable frequencies.
  1179.  
  1180.      Script execution will not continue until the time has elapsed.
  1181.  
  1182.      ■  Examples
  1183.  
  1184.      Sound 200, 30
  1185.  
  1186.      Sound 500, 10
  1187.  
  1188.  
  1189.  
  1190.      SUB
  1191.      ──────────────────────────────────────────────────────────────────────
  1192.  
  1193.      ■  Summary
  1194.  
  1195.      SUB <Integer1>, <Integer2>
  1196.  
  1197.      ■  Description
  1198.  
  1199.      The SUB function subtracts the value of <Integer2> from <Integer1> and 
  1200.      stores the result in <Integer1>.  Neither integer need be defined 
  1201.      prior to a SUB.  The first value must be an IntegerXX variable, and 
  1202.      the second value may be either a variable or a literal value.  The 
  1203.      comma between the two values is required.
  1204.  
  1205.      ■  See Also
  1206.  
  1207.      Assign, ADD, DIV, MUL
  1208.  
  1209.      ■  Example
  1210.  
  1211.      Assign Integer30, 20
  1212.      SUB Integer30, 5
  1213.      
  1214.  
  1215.  
  1216.      TIME
  1217.      ──────────────────────────────────────────────────────────────────────
  1218.  
  1219.      ■  Summary
  1220.  
  1221.      Time <String>
  1222.  
  1223.      ■  Description
  1224.  
  1225.      The Time function places the current time into <String>.  <String>
  1226.      must be a StringXX-type variable.
  1227.  
  1228.      ■  Example
  1229.  
  1230.      Time String16
  1231.  
  1232.  
  1233.  
  1234.      UPLOAD
  1235.      ──────────────────────────────────────────────────────────────────────
  1236.  
  1237.      ■  Summary
  1238.  
  1239.      Upload <String> With Protocol
  1240.  
  1241.      ■  Description
  1242.  
  1243.      The Upload function acts just as if you had pressed PgUp and entered a
  1244.      protocol and filename.  It will upload the file (or files if a batch
  1245.      protocol is used) indicated by <String>.  <String> may be a StringXX
  1246.      variable or a string constant in quotes.
  1247.  
  1248.      The Upload command uses the protocol specified on the command line by
  1249.      the With operator.  If a protocol is not specified, Telix will prompt
  1250.      for the protocol.  Protocols allowed following the With directive are:
  1251.  
  1252.                          Kermit
  1253.                          Modem7
  1254.                          SeaLink
  1255.                          Telink
  1256.                          Xmodem
  1257.                          1K-Xmodem
  1258.                          G-1K-Xmodem
  1259.                          Ymodem
  1260.                          Ymodem-G
  1261.                          Zmodem
  1262.  
  1263.      External protocols are not available from SIMPLE.
  1264.  
  1265.      Remember that uploads usually need to be triggered on the remote site
  1266.      before you can send the file.  You will usually need to Send a start
  1267.      command prior to using the Upload command.
  1268.  
  1269.      ■  Examples
  1270.  
  1271.      Assign String64, "D:\TELIX\DOWN\WORK\TELIX.REP"
  1272.  
  1273.      Send "U;Z" Enter
  1274.      Send Enter
  1275.      Upload String64 with Zmodem
  1276.  
  1277.      Send "U;G" Enter
  1278.      Send Enter
  1279.      Upload "C:\TELIX\DOWN\TLX320-1.ZIP" With Ymodem-G
  1280.  
  1281.  
  1282.  
  1283.      USAGELOG
  1284.      ──────────────────────────────────────────────────────────────────────
  1285.  
  1286.      ■  Summary
  1287.  
  1288.      UsageLog [On] [Off]
  1289.  
  1290.      ■  Description
  1291.  
  1292.      The UsageLog command toggles the Telix usage log on and off, just as
  1293.      Alt-U does in Telix.  You must specify the state you wish the log to
  1294.      be in, On or Off.
  1295.  
  1296.      ■  Example
  1297.  
  1298.      UsageLog On
  1299.  
  1300.      UsageLog Off
  1301.  
  1302.  
  1303.  
  1304.      WAIT
  1305.      ──────────────────────────────────────────────────────────────────────
  1306.  
  1307.      ■  Summary
  1308.  
  1309.      Wait Nx
  1310.  
  1311.      ■  Description
  1312.  
  1313.      The Wait function forces the script to pause for Nx seconds.
  1314.  
  1315.      ■  Example
  1316.  
  1317.      Wait 60
  1318.  
  1319.  
  1320.      ──────────────────────────────────────────────────────────────────────
  1321.  
  1322.  
  1323.  
  1324.  
  1325.      5.  Program Control
  1326.  
  1327.      SIMPLE scripts would be less than useful if there wasn't a way to
  1328.      cause the lines to execute out of order or in repetitive blocks.
  1329.      There are three commands that can cause a SIMPLE script to take on a
  1330.      much higher degree of functionality, and thus complexity.  We will
  1331.      start with the easier ones, and then move on to the more advanced
  1332.      ones.
  1333.  
  1334.  
  1335.  
  1336.      5.1  The Waitfor Command
  1337.      ──────────────────────────────────────────────────────────────────────
  1338.  
  1339.      Often when automating logons to online systems, you must enter
  1340.      information in response to a certain prompt, but it is not known
  1341.      exactly when that prompt will be ready for your input.  Waitfor
  1342.      simulates exactly what you would do when logging onto a system.  It
  1343.      waits for the prompt to appear, and then does what you tell it.
  1344.  
  1345.      ■  Summary
  1346.  
  1347.      WaitFor <String> [MaxOf Nx] Then <Command>
  1348.  
  1349.      <String> may be a literal string in quotes, or a StringXX variable.
  1350.      Case is not significant, and String must be no more than 40
  1351.      characters.
  1352.  
  1353.      The optional MaxOf directive tells the WaitFor command how long to
  1354.      wait before giving up.  Nx is a number of seconds to wait.  If MaxOf
  1355.      is defined, and Nx seconds elapse without <String> being received,
  1356.      SIMPLE skips <Command> and continues with the next command after that.
  1357.  
  1358.      <Command> is any valid built-in function from Chapter 4, including
  1359.      blocks surrounded by Begin and End.
  1360.  
  1361.      ■  Example
  1362.  
  1363.      Clark Development's PCBoard BBS prompts the user for various inputs,
  1364.      always in the same order.  It will prompt you for your color
  1365.      preference, your first name, your last name, and your password.  You
  1366.      can use the WaitFor command in a short SIMPLE script to automate this
  1367.      process as follows:
  1368.  
  1369.      Assign String1,   "Jeff"
  1370.      Assign String2,   "Woods"
  1371.      Assign String101, "first name"
  1372.      Assign String102, "last name"
  1373.  
  1374.      Waitfor "you want graphics" MaxOf 30 Then Send "Y Q" Enter
  1375.  
  1376.      Waitfor String101 MaxOf 10 Then
  1377.        Send String1 Enter
  1378.  
  1379.      Waitfor String102 MaxOf 10 Then Send String2 Enter
  1380.      Waitfor "ssword" MaxOf 10 Then Send BBSPassword Enter
  1381.  
  1382.  
  1383.  
  1384.      5.2  The If Command
  1385.      ──────────────────────────────────────────────────────────────────────
  1386.  
  1387.      The If conditional is one of the most powerful, and thus complex
  1388.      functions of SIMPLE.  It has several options and is relatively
  1389.      freeform, but it must follow certain conventions.
  1390.  
  1391.      Following the explanation of the If statement, our examples will
  1392.      become more complex, as we build on what you have learned so far.
  1393.  
  1394.      The general purpose of an If statement is to test to see if a certain
  1395.      condition is true, and to execute certain commands if so, or
  1396.      optionally, certain commands if not.
  1397.  
  1398.      ■  Summary
  1399.  
  1400.      If [Not] <Condition> Then <Command> [ElseIf <Command>] [Else...]
  1401.  
  1402.      <Condition> is the quality you wish to test for being true or false.
  1403.      Conditions may be comparing strings for equality to each other,
  1404.      checking for the existence of a certain file on the disk, or for
  1405.      checking to see if a certain condition exists, such as if Telix is
  1406.      connected to a system.  You can check for the opposite condition by
  1407.      preceding <Condition> with the optional directive Not.
  1408.  
  1409.      The Then keyword is required for all If statements, and must follow
  1410.      the <Condition>.
  1411.  
  1412.      <Command> is the action that could be performed based on the result of
  1413.      the Condition.  <Command> may be any of the built-in functions of
  1414.      SIMPLE, and can even be a group of instructions marked by Begin and
  1415.      End.
  1416.  
  1417.      Else and ElseIf statements will be explained shortly.
  1418.  
  1419.  
  1420.      There are five predefined conditions that can be used:
  1421.  
  1422.      1.  Online     You may check the state of the carrier detect signal to
  1423.                     determine if you are connected to another system or
  1424.                     not.  The format of the Online conditional is:
  1425.  
  1426.                     If [Not] Online [=Yes] [=No] Then <Command>
  1427.  
  1428.                     "Yes" and "No" are optional and are only included for
  1429.                     clarity.  Examples of the Online conditional are:
  1430.  
  1431.                          If Online Then
  1432.                            Begin
  1433.                              Download "TELIX.QWK" With ZModem
  1434.                              EraseFile "TELIX.REP"
  1435.                            End
  1436.  
  1437.                          If Not Online Then
  1438.                            Dial "m1-919-481-9399" MaxOf 50
  1439.  
  1440.                          If Online=No Then Dial "5"
  1441.  
  1442.  
  1443.      2.  Exist      You may check for the existence of a file on the disk
  1444.                     prior to attempting an action on that file.  The format
  1445.                     of the Exist conditional is:
  1446.  
  1447.                     If [Not] Exist <String> Then <Command>
  1448.  
  1449.                     <String> may be a StringXX variable or a string
  1450.                     constant in quotes.  Examples of the Exist conditional
  1451.                     are:
  1452.  
  1453.                          Assign String1, "D:\TELIX\QWK\TELIX.REP"
  1454.  
  1455.                          If Exist String1 Then
  1456.                            Upload String1 With Zmodem
  1457.  
  1458.                          If Not Exist String1 Then
  1459.                            If Online Then
  1460.                              Begin
  1461.                                Download String1 With Zmodem
  1462.                                EraseFile "ANYFILE"
  1463.                              End
  1464.  
  1465.                     As you can see, our examples are becoming a bit more
  1466.                     complex as more commands are introduced.
  1467.  
  1468.      3.   BBSNumber You may check the value of this system variable to
  1469.                     determine which dialing directory entry number you last
  1470.                     connected to.  The format of the BBSNumber conditional
  1471.                     is:
  1472.  
  1473.                     If [Not] BBSNumber = Nx Then <Command>
  1474.  
  1475.                     <Nx> is any integer number.  For example, if you know
  1476.                     that the Telix Support BBS is entry # 1 in the current
  1477.                     dialing directory, and you wish to find out if we are
  1478.                     currently online with this particular system, you could
  1479.                     nest two If statements together:
  1480.  
  1481.                          If Online Then
  1482.                            If BBSNumber = 1 Then
  1483.                              Begin
  1484.                                EraseFile "TELIX.QWK"
  1485.                                Download "TELIX.QWK" With Zmodem
  1486.                              End
  1487.  
  1488.                     Note that the <Command> executed for "If Online"
  1489.                     encompasses all of the rest of the above example
  1490.                     through the End statement.  This is the reason for the
  1491.                     indentation as above.  It reminds us which lines
  1492.                     comprise the <Command> to execute if <Condition> is
  1493.                     true.
  1494.  
  1495.      4.   ReturnCode     
  1496.  
  1497.                     You may check the results of any of three other SIMPLE
  1498.                     commands with the ReturnCode system variable.  Two of
  1499.                     them we have covered, the third we shall shortly.  The
  1500.                     three commands you can check for success are Dos, Dial,
  1501.                     and RunScript.
  1502.  
  1503.                     The format of the ReturnCode conditional is as follows:
  1504.  
  1505.                     If [Not] ReturnCode = Nx Then <Command>
  1506.  
  1507.                     <Nx> is any integer number.  For example, if you know
  1508.                     that the program Foo.EXE returns a DOS Errorlevel of 1
  1509.                     if today is a Saturday, and an Errorlevel of 0 for
  1510.                     every other day of the week, you might want to try
  1511.                     something like the following, which would call the
  1512.                     Telix BBS to download a mail packet on Saturdays only.
  1513.                     Again, we shall try to integrate what we have learned
  1514.                     thus far into more and more complex examples:
  1515.  
  1516.                          Dos "Foo.EXE"
  1517.                          If ReturnCode = 1 Then
  1518.                            Begin
  1519.                              Dial "m1-919-481-9399" Maxof 50 Runscript         
  1520.                              Send "QMAIL4 D;Y"
  1521.                              Download "TELIX.QWK" With Zmodem
  1522.                              Hangup
  1523.                            End
  1524.  
  1525.      5.   TransferStatus
  1526.  
  1527.                     You may check the result of the Upload or Download
  1528.                     commands with the TransferStatus system variable.  The
  1529.                     format of a TransferStatus conditional is as follows:
  1530.  
  1531.                     If [Not] TransferStatus = Nx Then <Command>
  1532.  
  1533.                     Nx is any integer number.  The following example will
  1534.                     try to send a mail packet to the Telix BBS and if not
  1535.                     successful, will try again.  The example assumes that
  1536.                     we are already logged on and ready to upload.
  1537.  
  1538.                          Send "TELIX.REP" With Zmodem
  1539.                          If TransferStatus = 0 Then
  1540.                            Send "TELIX.REP" With Zmodem
  1541.  
  1542.  
  1543.      An optional Else or ElseIf command may be appended to any If statement
  1544.      to further control the flow of the program.  ElseIf and Else
  1545.      statements may be nested within one another, and infinitely deep.
  1546.  
  1547.      ElseIf statements indicate another If condition is to be checked in
  1548.      the case of the first If being false.  Else statements indicate the
  1549.      end of an If chain.
  1550.  
  1551.      The following is perfectly valid, and quite common:
  1552.  
  1553.                          If Online Then
  1554.                            Begin
  1555.                              Send "U;Z" Enter
  1556.                              Upload "Telix.REP" with Zmodem
  1557.                              If TransferStatus = 0 Then
  1558.                                Download "Telix.QWK" with Xmodem
  1559.                              ElseIf
  1560.                                Upload "Telix.REP" With Zmodem
  1561.                              Else
  1562.                                Hangup
  1563.                            End
  1564.                          Else
  1565.                            Dial "11"
  1566.  
  1567.  
  1568.      Note the nesting and indentation of each individual command beneath
  1569.      the If that it is a part of.  Clear, concise indentation can go a long
  1570.      way to making your scripts easier to read and write.
  1571.  
  1572.  
  1573.  
  1574.      5.3  The Whenever Loop
  1575.      ──────────────────────────────────────────────────────────────────────
  1576.  
  1577.      The Whenever loop is the most powerful, and thus most complex function
  1578.      of SIMPLE.  It has several options and is relatively freeform, but it
  1579.      must follow certain conventions.
  1580.  
  1581.      The purpose of a Whenever loop is best explained in terms of WaitFor.
  1582.      Please be sure you understand Waitfor before continuing here.
  1583.  
  1584.      One of the inherent problems of WaitFor is that the order the prompts
  1585.      come in must be fixed.  One particular bulletin board can randomly
  1586.      prompt your for your birthday as verification of who you really are.
  1587.      Such a prompt renders the WaitFor command fairly useless.
  1588.  
  1589.      Whenever is the answer to this problem.  You may set up a group of up
  1590.      to sixteen different strings and can define the proper actions SIMPLE
  1591.      should take whenever that particular prompt comes in.  The order of
  1592.      the prompts will not matter.  If your prompt comes in, then the
  1593.      defined action will occur.  The general format of a Whenever Loop is
  1594.      defined below.
  1595.  
  1596.      ■  Summary
  1597.  
  1598.      WhenLoop
  1599.          Whenever <String> Then <Command>
  1600.          Whenever <String> Then <Command>
  1601.          Whenever <String> Then <Command>
  1602.          ....
  1603.      EndWhen
  1604.  
  1605.      A Whenever Loop begins with the keyword WhenLoop.
  1606.  
  1607.      Immediately following WhenLoop must follow a series of up to sixteen
  1608.      Whenever directives.  A whenever directive defines the <String> to
  1609.      watch for, and the <Command> to execute when the <String> is received.
  1610.      The keyword Then must appear between the two, exactly as above.
  1611.  
  1612.      <String> may be a StringXX variable or a string constant in quotes.
  1613.      Case is not significant, and <String> may be no longer than 40
  1614.      characters.
  1615.  
  1616.      Whenever <String> is received, <Command> will be executed.  The power
  1617.      of the Whenever loop lies in the fact that absolutely any SIMPLE
  1618.      construct may be used here as the <Command> (other than another
  1619.      Whenever loop).  Waitfor, If, or any built-in function from chapter 4
  1620.      may be used.
  1621.  
  1622.      The keyword EndWhen must follow the last Whenever directive.
  1623.  
  1624.      The keyword QuitWhen is used to exit from a given WhenLoop at the
  1625.      proper time.
  1626.  
  1627.  
  1628.      Using the example of a BBS which can randomly prompt for your date of
  1629.      birth during the login, lets write a script to log on to that system,
  1630.      enter the mail door, download a mail packet, and log off.
  1631.  
  1632.      ■  Example
  1633.  
  1634.      WhenLoop
  1635.        Whenever "language t"   Then Send "2"         Enter
  1636.        Whenever "first name"   Then Send "Jeff"      Enter
  1637.        Whenever "last name"    Then Send "Woods"     Enter
  1638.        Whenever "ssword"       Then Send BBSPassword Enter
  1639.        Whenever "birthday"     Then Send "03/25/66"  Enter
  1640.        Whenever "new mail"     Then Send "N Q"       Enter
  1641.        Whenever "rd Command"   Then Send "MAILDOOR"  Enter
  1642.        Whenever "mail Command" Then
  1643.          Begin
  1644.            Send "D;Y" Enter
  1645.            Waitfor "ready to Send Telix.QWK" MaxOf 300 Then
  1646.              Download "TELIX.QWK" With Zmodem
  1647.            If TransferStatus = 0 Then
  1648.              Begin
  1649.                Message "Download Not Successful!"
  1650.                Sound 200, 2
  1651.              End
  1652.            Else
  1653.              Begin
  1654.                Wait(20)
  1655.                Send "G;Y" Enter
  1656.                Hangup
  1657.                QuitWhen
  1658.              End
  1659.          End
  1660.      EndWhen
  1661.  
  1662.      This entire script would log you onto the BBS, and would answer the
  1663.      random birthday prompt if it appeared.
  1664.  
  1665.      The last Whenever directive specifies to the script that it is to do
  1666.      everything within the outermost Begin/End.  Note that the final
  1667.      whenever is in response to a prompt that indicates we are in the mail
  1668.      door.  If we are in the mail door, we send a command to start the
  1669.      download of a mail packet.  When the packet is ready, we actually
  1670.      attempt download.  Upon checking the result of the transfer, we either
  1671.      log off and exit the WhenLoop (we did what we wanted), or we make a
  1672.      beep and go back to the whenloop, which will trigger again on the mail
  1673.      Command prompt, and try to download again.
  1674.  
  1675.      Study the example above carefully, as it is very typical of a complete
  1676.      SIMPLE script.  Be careful when using WhenLoops as the above script
  1677.      can try over and over to download a packet.  If there is a problem
  1678.      downloading due to the BBS, you could run up quite a bill.  Advanced
  1679.      automation scripts should probably be in SALT, which allows greater
  1680.      control.
  1681.  
  1682.  
  1683.  
  1684.