home *** CD-ROM | disk | FTP | other *** search
- DOCUMENTATION FOR
-
- CHOICE
-
- CHOICE Ver. 1.0 Copyright (c) 1984 Bruce N. Wheelock
-
- NOTICE: A limited license is granted to all users of CHOICE.COM
- and CHOICE.PAS to make copies of them and distribute them
- to other users, on the following conditions:
-
- 1. The program is not to be distributed to others in
- modified form.
- 2. No fee (or other consideration) is to be charged for
- copying or distributing the program without an express
- written agreement with the author.
- 3. The copyright and description information in the
- program is not to be altered or removed.
-
- AUTHOR: Bruce N. Wheelock
- 6333 College Grove Way, Apt. G-4
- San Diego, CA 92115
-
- The author may be contacted on the following public
- access computer systems:
-
- P.dBMS #1 (619) 444-7099 (address to Bruce N. Wheelock)
- FidoNet/FTL (619) 286-7838 (address to Bruce Wheelock)
-
- DESCRIPTION: CHOICE is designed to be used within a batch file
- under PC-DOS/MS-DOS ver. 2.0 or later, to permit menu
- selection control; it will mainly be of interest to hard
- drive users. The program is called with an integer
- argument which specifies the largest choice number which
- may be selected. CHOICE will prompt the user for his
- choice number and check to see whether the number entered
- is an integer between 0 and the value in the argument. If
- it is not, an error message is displayed and the user is
- again prompted for a choice. If the number is within the
- range, ERRORLEVEL (a batch-testable value) is set to the
- number entered, and the program ends. ERRORLEVEL may
- then be tested by the batch file and action taken based
- on the result.
-
- USE: Here is a sample batch file:
-
- ECHO OFF
- :START
- CLS
- ECHO 1. Run LOTUS 1-2-3
- ECHO 2. Run Microsoft WORD
- ECHO 3. Run Microsoft SPELL
- ECHO 4. Run SMARTCOM II
- ECHO 0. Exit to DOS
- ECHO
- REM The previous line has two (2) blanks after ECHO
- IF NOT ERRORLEVEL 4 GOTO THREE
- SCOM
- GOTO START
- :THREE
- IF NOT ERRORLEVEL 3 GOTO TWO
- SPELL
- GOTO START
- :TWO
- IF NOT ERRORLEVEL 2 GOTO ONE
- WORD
- GOTO START
- :ONE
- IF NOT ERRORLEVEL 1 GOTO ZERO
- LOTUS
- GOTO START
- :ZERO
- IF NOT ERRORLEVEL 0 GOTO START
- REM End of batch file
-
- NOTES: When ERRORLEVEL is checked in a batch file, the IF is
- satisfied if the value is equal to or greater than the
- value tested. Because of this, testing must begin at the
- highest possible value and decrease to the lowest.
- Detailed information on batch files may be found in your
- DOS manual.
-
- Turbo PASCAL .COM programs have an instruction to clear
- the screen when the program begins. This is not
- desirable in CHOICE. It is necessary, therefore, to
- disable the screen clearing instruction. This
- instruction is located at memory address 02FC. The
- instruction is CD10 (Interrupt 10). It may be disabled
- by changing the instruction to 9090. To do this using
- DEBUG.COM, follow these procedures:
-
- A>DEBUG CHOICE.COM
- -E02FC
- NNNN:02FC CD.90 [Type the 90 and press return]
- -E02FD
- NNNN:02FD 10.90 [Type the 90 and press return]
- -W
- Writing nnnn blocks
- -Q
- A>
-
- For instructions on using DEBUG, consult your DOS manual.
-
- Program results will be unpredictable if the argument to
- the program is not an integer. If no argument is
- specified, the value defaults to 1 (one).
-
- ACKNOWLEDGMENTS: The procedure GetMax is adapted from
- CMDLINE.PAS, posted on FidoNet/FTL by Bruce Webster
- (SYSOP). The procedure SetErrlevel is adapted from a
- program by Bruce Webster and myself. Help in eliminating
- the screen clear instruction was provided by Bill Parker
- of Ashton-Tate.