home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
modem
/
jbtutor1.zip
/
LESSON11.TXT
< prev
next >
Wrap
Text File
|
1993-09-17
|
3KB
|
72 lines
Error Trapping
--------------
Regardless of how well you've planned, flowcharted, coded
your script, you need to account for the unexpected. Even if your
script has worked flawlessly for many consecutive sessions, things
can happen which will cause your script to hang -- BBS version
upgrades can bring new prompts, sometimes things go wrong with BBS
software which cause a "hang" at the BBS end of things, an obscure
prompt might pop up by chance that you just haven't seen yet, etc.
There are two fundamental methods for dealing with a "hang"
event:
a. If the "hang" is at your end (the BBS is prompting you
for some input, but your script is not responding because it's
looking for a different prompt), odds are the BBS will eventually
time you out for no keyboard activity and will drop carrier on you.
One method for dealing with this type hang is to liberally add the
following (or similar) command before every "LOOK" command in your
script:
{GOLO name,^jNO CARRIER^m}
You would need to substitute a macro ID of your choice for "name" in
the above example. "Name" would be whatever macro you've designed
for execution after a session is complete with a BBS. "Name" could
do things like close your capture file if one is opened, return to
the DIAL function if you use the script to dial more than one BBS,
etc. The "^j" and "^m" in the no carrier string prevent accidental
interpretation of the words "no carrier" in text sent by the BBS as
an actual "no carrier" response from your modem. These symbols
represent a Carriage Return and Line Feed..characters unlikely to be
associated with randomly occurring "no carrier" text from the BBS..
b. If the hang is at the BBS end (something has gone wrong
with the BBS software or hardware), then all that is needed is to
ensure you include a timer function in your script that escapes to
"name" after whatever amount of time you think is sufficient. This
is accomplished via your "SETLook" definitions I disscussed in
earlier sessions. For example, if you determine that 3 minutes is an
adequate amount of time for the script to wait for some prompt, then:
{SETL 180,"name",,} (where "name" is the same macro I
mentioned above)
would accomplish the "escape" branch in case something went wrong at
the BBS end. This would also handle the case of the BBS *not*
dropping carrier on you in the event the "hang" is at your end. Some
BBSs I've called don't have a default keyboard timeout and would sit
there waiting on a response to a prompt forever.
FWIW, here's what a "name" macro might look like (feel free to modify to
suit your own needs). Let's give this macro the name of "gby":
.
.
{:GBY}
{HANG y} - hangs up the phone
{CAPT n} - close the capture file that's open
{SETV bbsid} ─┐
{SETV x} ├ Reset any "BBS-specific" variables in case
{SETV y} │ the script is used to dial several differnt
{SETV z} ─┘ BBSs
{RETU} - returns to the "dial" function
Believe it or not, these lessons have now provided enough info to
write a complete mailrun script. Following lessons will pertain to
"enhancements".
Jim