home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / modem / jbtutor1.zip / LESSON4.TXT < prev    next >
Text File  |  1993-06-17  |  4KB  |  80 lines

  1.         Previous lessons introduced the concept of marking/dialing
  2. BBSs.  We're now at the point where the script segments we'll be
  3. writing will be those that communicate with a BBS after a successful
  4. connection.
  5.  
  6.         When you dial a BBS manually, you respond to a series of
  7. prompts which are presented by the BBS.  Any script you write needs
  8. to also respond to these same prompts.  Any other material that
  9. scrolls automatically is irrelevant to the script..you do not need to
  10. account for these items, e.g., the BBS Welcome Screen,  any "news"
  11. files, the Main Menu, etc..remember:
  12.  
  13.         A prompt is a point at which you must respond from your
  14.         keyboard in order to continue.  A script must be able to
  15.         respond to these prompts the same way you would do if you
  16.         were calling the BBS manually.
  17.  
  18.         We will set up our script to "watch" for specific text
  19. strings to come into the I/O port from the BBS and then make
  20. assumptions/act on the string after it's received.  Here's an example
  21. of a BBS prompt that's probably very familiar to you:
  22.  
  23.      Please Enter Your Real First Name?
  24.  
  25.         If you were calling manually, you'd naturally enter your
  26. first name and press <RETURN>.  {COMMO} has several different methods
  27. for "watching" for incoming strings..the most fundamental of which is
  28. "{LOOK}".  {COMMO}'s method of sending text out the comm port is
  29. "{SEND}".  Here's how we might account for the login prompt for our
  30. first name:
  31.  
  32.         {LOOK Please Enter Your Real First Name?}
  33.         {SEND Jim|}         <- Note:  {COMMO} translates the "|" character
  34.                                into a "Carriage Return"
  35.  
  36.         Now's a good point to introduce an important concept
  37. concerning prompts..something I'll call "minimal prompt".  In the
  38. example above, I used the entire "Please enter.." prompt as something
  39. to look for.  That's OK, but what if we get a little burst of line
  40. noise while the prompt is being displayed?  {COMMO} looks for *exact*
  41. text matches on its "LOOK" functions.  Any deviation in the incoming
  42. string will cause {COMMO} to "miss" the prompt.  To prevent this, you
  43. should specify only enough of any given prompt that retains a high
  44. level of "uniqueness" to the prompt as far as being recognized for
  45. what it really is.  {COMMO} doesn't care if the particular string its
  46. looking for makes sense, all that matters is the match is exact.
  47. Using my example, suppose we chose to look only for "First Name?",
  48. i.e., "{LOOK First Name?}".  If the login prompt for "first name" is
  49. the only place this particular string occurs, then it would be safe
  50. to reduce our "LOOK"ed for text down to these two words and the
  51. question mark.  My advice on what to use when specifying prompts to
  52. "LOOK" for is:
  53.  
  54.         LOOK for a minimal portion of a BBS prompt.  Define that
  55.         minimal portion to be something that sets the string apart as
  56.         a prompt, rather than as a random occurring string of text in
  57.         extraneous portions of a BBS session.  You'll find that
  58.         puncuation, e.g., the "?" will often appear with certain text
  59.         strings only in prompts.  A classic example is PCBoard's
  60.         "Command?" string.
  61.  
  62. Here's an example:  Suppose a BBS "Main Menu" prompt is:
  63.  
  64.         MAIN MENU <A,C,D,F,R,U,Z>?
  65.  
  66. A suitable "minimal approach" to handling this prompt could easily be
  67. any of the following strings "{LOOK MAIN MENU}", "{LOOK <A}", or
  68. {LOOK Z>?}.  Personally, I try to use the least amount of a prompt
  69. which includes the *last* character in the original BBS prompt, yet
  70. maintains a uniqueness which sets the string apart as a prompt.  In
  71. the example, above, then..I'd be likely to use "{LOOK Z>?}.
  72.  
  73. END OF LESSON #4
  74. Homework:  Study the following {COMMO} macro command syntax:  LOOK,
  75. GOLOok, CALOok, SSLOok.
  76. Next Lesson:  We'll take a stab at the "Logon" process for our
  77. Mailrun script.
  78.  
  79. Jim
  80.