home *** CD-ROM | disk | FTP | other *** search
- Bat-Ques
- --------
-
- To ask a question:
-
- Bat-Ques tttttt$ where ttttttt is the text of the question
-
- User then keys a single character response.
-
- To check answer, use IF [not] errorlevel cc, where cc is the
- character code value of the response. Only single character responses
- are supported.
-
- This program allows one to build decently friendly batch files. One
- no longer has only the ctrl-break response to a pause (which isn't
- very friendly).
-
- Examples:
-
- This program allows a batch file to ask the user a question and
- return a one-character response which is testable by the IF
- subcommand of bat files, via the errorlevel.
-
- You use the question asker per following example:
-
- .
- . (your batch file to ask if user wants to edit with
- . mince/emacs or ibm's editor)
- .
- echo off
- bat-ques WHICH EDITOR, m OR e FOR MINCE (EMACS), i FOR IBM's? $
- if errorlevel 110 goto badresp
- if errorlevel 109 goto minceed
- if errorlevel 106 goto badresp
- if errorlevel 105 goto ibmed
- if errorlevel 102 goto badresp
- if errorlevel 101 goto minceed
- :badresp
- echo Your response was invalid. Sorry.
- goto endit
- :minceed
- if not exist mincomm.sum copy \bin\mince.swp mince.swp
- mince %1
- if not exist mincomm.sum del mince.swp
- goto endit
- :ibmed
- profed %1
- :endit
- echo on
-
- Note that the question prompt follows the bat-ques command and must
- end with a dollar sign. The ascii value of the response is returned
- as the error level. Since error level tests are always greater than
- or equal tests, you must check for highest value first and lowest
- value last. Example above shows what you do to check for missing
- values. Note that the example assumes lower case answers only for
- simplicity sake.
-
- Ascii values (e.g., A is 65, B is 66, a is 97) are found in back of
- your BASIC manual. Only one character responses are accepted, and
- they are not followed by a carriage return.
-
- Extended ascii codes (function and alt keys) should work as per page
- G-6 of your BASIC manual; the first call to bat-ques will return a
- zero and the next call (presumably "bat-ques $" without another
- prompt) will return the number shown on page G-7.
-
-
-