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

  1. Error Trapping
  2. --------------
  3.  
  4.         Regardless of how well you've planned, flowcharted, coded
  5. your script, you need to account for the unexpected.  Even if your
  6. script has worked flawlessly for many consecutive sessions, things
  7. can happen which will cause your script to hang -- BBS version
  8. upgrades can bring new prompts, sometimes things go wrong with BBS
  9. software which cause a "hang" at the BBS end of things, an obscure
  10. prompt might pop up by chance that you just haven't seen yet, etc.
  11.  
  12.         There are two fundamental methods for dealing with a "hang"
  13. event:
  14.  
  15.         a.  If the "hang" is at your end (the BBS is prompting you
  16. for some input, but your script is not responding because it's
  17. looking for a different prompt), odds are the BBS will eventually
  18. time you out for no keyboard activity and will drop carrier on you.
  19. One method for dealing with this type hang is to liberally add the
  20. following (or similar) command before every "LOOK" command in your
  21. script:
  22.  
  23.         {GOLO name,^jNO CARRIER^m}
  24.  
  25. You would need to substitute a macro ID of your choice for "name" in
  26. the above example.  "Name" would be whatever macro you've designed
  27. for execution after a session is complete with a BBS.  "Name" could
  28. do things like close your capture file if one is opened, return to
  29. the DIAL function if you use the script to dial more than one BBS,
  30. etc.  The "^j" and "^m" in the no carrier string prevent accidental
  31. interpretation of the words "no carrier" in text sent by the BBS as
  32. an actual "no carrier" response from your modem.  These symbols
  33. represent a Carriage Return and Line Feed..characters unlikely to be
  34. associated with randomly occurring "no carrier" text from the BBS..
  35.  
  36.         b.  If the hang is at the BBS end (something has gone wrong
  37. with the BBS software or hardware), then all that is needed is to
  38. ensure you include a timer function in your script that escapes to
  39. "name" after whatever amount of time you think is sufficient.  This
  40. is accomplished via your "SETLook" definitions I disscussed in
  41. earlier sessions. For example, if you determine that 3 minutes is an
  42. adequate amount of time for the script to wait for some prompt, then:
  43.  
  44.         {SETL 180,"name",,}  (where "name" is the same macro I
  45. mentioned above)
  46.  
  47. would accomplish the "escape" branch in case something went wrong at
  48. the BBS end.  This would also handle the case of the BBS *not*
  49. dropping carrier on you in the event the "hang" is at your end.  Some
  50. BBSs I've called don't have a default keyboard timeout and would sit
  51. there waiting on a response to a prompt forever.
  52.  
  53. FWIW, here's what a "name" macro might look like (feel free to modify to
  54. suit your own needs).  Let's give this macro the name of "gby":
  55.  
  56. .
  57. .
  58. {:GBY}
  59.      {HANG y}      - hangs up the phone
  60.      {CAPT n}      - close the capture file that's open
  61.      {SETV bbsid}  ─┐
  62.      {SETV x}       ├ Reset any "BBS-specific" variables in case
  63.      {SETV y}       │ the script is used to dial several differnt
  64.      {SETV z}      ─┘ BBSs
  65.      {RETU}        - returns to the "dial" function
  66.  
  67. Believe it or not, these lessons have now provided enough info to
  68. write a complete mailrun script.  Following lessons will pertain to
  69. "enhancements".
  70.  
  71. Jim
  72.