
Lesson #21 - Automating the creation of a .CFG file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        If you're like me, you'll want to make things as easy as
possible when it comes to automating your BBS sessions.  In previous
lessons, I introduced the concept of reading BBS-specific data items
from a .CFG file.  One method you can use to automate the creation of
these .CFG files is to write a separate macro that accomplishes the
following goals:

        - prompts you to enter data corresponding to the prompts &
responses that will be used by the main script routine

        - creates a "bbsid".cfg file

        - writes the data you have entered to this .cfg file in the
proper sequence so that, when read by the main script routine upon
script execution, the data items will correlate to the variable
entries used by the main script routine.

        You can get as fancy as you like with this prompt/write
macro, e.g., colors, menus, screen clearing, whatever.  The
.cfg setup macro, though will basically prompt you to enter one
response for each potential data item that could be in the .CFG.  An
example of how this might appear:

{:START}
  {CLEA}{CURS y}{SPOC n}{LOCA y}{STAT n}
  {SETG 360,exit}
  {DISP 2,1,0c,All prompt input is limited to 10 characters}
  {DISP 4,1,0c,What is the "bbsid" for this board?}
  {GETS bbsid,8,}
  {DISP 5,1,0c,What is the "Press Esc" prompt?: }
  {GETS esc_p,10,}
  {DISP 6,1,0c,What is the response to this prompt?: }
  {GETS esc_r,10,}
  {DISP 7,1,0c,What is the "read bulletins?" prompt?: }
  {DISP 8,1,0c,What is the response to this prompt?: }
  .
  .   One prompt for input for each required data item.  You will
  .   need one prompt for every "READ" statement in the main macro
  .   routine

The order in which you prompt for data input is not important.  You
can group items together functionally, alphabetically, or in any
order you wish.  What _is_ important is that your "WRIT" statements
write the data in precisely the same order as the "READ" statements
in the main script routine.

For example, if the main script READ statements are:
{READ this}{READ that}{READ more}{READ none}{READ test}

..then the WRITe statements in the .CFG setup macro will be:

{WOPE c:\commo\cfg\%bbsid.cfg}
{WRIT %this}{WRIT %that}{WRIT %more}{WRIT %none}{WRIT %test}{WCLO}

This ensures the data is in the correct order, even though the actual
prompting for data entry may have been in the following sequence:
none, more, that, this, test

To reduce confusion, I recommend using the same variable names in
the setup macro's GETString commands as are used in the main macro
routine.

Again, you can get as creative as you like with a setup macro..you
can include defaults, you can clear the screen between each prompt
for data input, you can add menus, you can include tests on the
input, you can echo the input with a "this is what you entered..are
you sure this is what you want?" type feedback.  The _fundamental_
functions to be performed, though are 1) prompt for input, 2) open a
file with filename "bbsid".cfg (or whatever extension you
prefer..doesn't have to be .cfg..just as long as extension is
consistent with what you use in the main script routine's {ROPE
bbsid."ext"), and 3) write the data you've entered in the proper
sequence.

Jim
