home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
modem
/
jbtutor1.zip
/
LESSON4.TXT
< prev
next >
Wrap
Text File
|
1993-06-17
|
4KB
|
80 lines
Previous lessons introduced the concept of marking/dialing
BBSs. We're now at the point where the script segments we'll be
writing will be those that communicate with a BBS after a successful
connection.
When you dial a BBS manually, you respond to a series of
prompts which are presented by the BBS. Any script you write needs
to also respond to these same prompts. Any other material that
scrolls automatically is irrelevant to the script..you do not need to
account for these items, e.g., the BBS Welcome Screen, any "news"
files, the Main Menu, etc..remember:
A prompt is a point at which you must respond from your
keyboard in order to continue. A script must be able to
respond to these prompts the same way you would do if you
were calling the BBS manually.
We will set up our script to "watch" for specific text
strings to come into the I/O port from the BBS and then make
assumptions/act on the string after it's received. Here's an example
of a BBS prompt that's probably very familiar to you:
Please Enter Your Real First Name?
If you were calling manually, you'd naturally enter your
first name and press <RETURN>. {COMMO} has several different methods
for "watching" for incoming strings..the most fundamental of which is
"{LOOK}". {COMMO}'s method of sending text out the comm port is
"{SEND}". Here's how we might account for the login prompt for our
first name:
{LOOK Please Enter Your Real First Name?}
{SEND Jim|} <- Note: {COMMO} translates the "|" character
into a "Carriage Return"
Now's a good point to introduce an important concept
concerning prompts..something I'll call "minimal prompt". In the
example above, I used the entire "Please enter.." prompt as something
to look for. That's OK, but what if we get a little burst of line
noise while the prompt is being displayed? {COMMO} looks for *exact*
text matches on its "LOOK" functions. Any deviation in the incoming
string will cause {COMMO} to "miss" the prompt. To prevent this, you
should specify only enough of any given prompt that retains a high
level of "uniqueness" to the prompt as far as being recognized for
what it really is. {COMMO} doesn't care if the particular string its
looking for makes sense, all that matters is the match is exact.
Using my example, suppose we chose to look only for "First Name?",
i.e., "{LOOK First Name?}". If the login prompt for "first name" is
the only place this particular string occurs, then it would be safe
to reduce our "LOOK"ed for text down to these two words and the
question mark. My advice on what to use when specifying prompts to
"LOOK" for is:
LOOK for a minimal portion of a BBS prompt. Define that
minimal portion to be something that sets the string apart as
a prompt, rather than as a random occurring string of text in
extraneous portions of a BBS session. You'll find that
puncuation, e.g., the "?" will often appear with certain text
strings only in prompts. A classic example is PCBoard's
"Command?" string.
Here's an example: Suppose a BBS "Main Menu" prompt is:
MAIN MENU <A,C,D,F,R,U,Z>?
A suitable "minimal approach" to handling this prompt could easily be
any of the following strings "{LOOK MAIN MENU}", "{LOOK <A}", or
{LOOK Z>?}. Personally, I try to use the least amount of a prompt
which includes the *last* character in the original BBS prompt, yet
maintains a uniqueness which sets the string apart as a prompt. In
the example, above, then..I'd be likely to use "{LOOK Z>?}.
END OF LESSON #4
Homework: Study the following {COMMO} macro command syntax: LOOK,
GOLOok, CALOok, SSLOok.
Next Lesson: We'll take a stab at the "Logon" process for our
Mailrun script.
Jim