home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
- DCH
- Free DOS utility: batch file query
- Version 1.01 - September 07, 1993
- (c) 1993
- by
- David Daniel Anderson
- Reign Ware
-
-
-
-
-
- DCH reads a keystroke and sets the DOS errorlevel accordingly.
- Timeout, valid keys, prompt and color are easily configurable.
-
-
- USAGE:
- ------
- DCH timeout_spec keys [text]
-
- EXAMPLES:
- ---------
-
- DCH [10] YynN Do you wish to continue [Y/n]?
- DCH [] NnyYaA Do you wish to continue [y/N/a]?
- DCH [0] h Try and stop me...
- DCH [4000] ~. Guess one of the magic keys!
- DCH [10] yn
-
- ("Text" is optional, but "timeout_spec" and "keys" are mandatory.)
-
-
- TIMEOUT_SPEC:
- -------------
- The timeout_spec must begin with: [ and end with: ]
-
- [] will disable the timeout. Then DCH will wait forever for a key.
-
- [0] will set the timeout to 0, which will cause DCH to check for a
- keystroke in the keyboard buffer. DCH will use it if it exists,
- but default (as usual) to the first of the specified keys if not.
-
- [65535] is the maximum specifiable timeout period - over 18 hours.
-
- If the specified time expires without a valid keypress, then the errorlevel
- is set to the -position- of the first of the valid keys (errorlevel=1).
-
-
- KEYS:
- -----
- Case is always sensitive, so Y and y are -not- identical keys.
-
- The keys can be any displayable characters from the standard IBM ASCII
- character set, with the exception of: space, <, >, and |.
-
- The DOS errorlevel will contain a number equal to the -position- of the
- pressed key within the "valid keys" string.
-
- In other words, the first key you assign returns a value of 1, the second
- a value of 2, the third a value of 3, and so on.
-
- If the user presses a key that is not among the keys you assigned, DCH
- forces the user to press another key, until the time allotted has passed.
- If the time expires, DCH selects the first assigned key as the default.
-
- If a parsing error (anticipated) occurs, DCH returns a value of 201-210,
- and then writes the error number and reason for the error.
-
-
- TEXT:
- -----
- All text after the final specified key will be displayed as a prompt,
- and can include any displayable ASCII characters except: <>|
-
- Thus you cannot use: DCH [7] yn Are you human <y|n>?
-
- The key that the user presses will be written to the screen if and
- -only- if there is text on the command line.
-
-
- COLOR:
- ------
- Finally, you -may- choose what color you want the text to be displayed
- in by using the DOS SET command to SET an environmental variable:
-
- DCHCLR=nnn - where nnn is the decimal of the color value (0-255).
-
- For example, to set the color of the output to White on Blue, use:
-
- SET DCHCLR=31
-
- Calculate the value by adding foreground + background + blink.
-
- Foreground Background Blink
- ---------- ---------- -----
- 00 = Black 00 = Black 00 = Off
- 01 = Blue 16 = Blue 128 = On
- 02 = Green 32 = Green
- 03 = Cyan 48 = Cyan
- 04 = Red 64 = Red
- 05 = Magenta 80 = Magenta
- 06 = Brown 96 = Brown
- 07 = Light gray 112 = Light gray
- 08 = Dark gray
- 09 = Light blue
- 10 = Light green
- 11 = Light cyan
- 12 = Light red
- 13 = Light magenta
- 14 = Yellow
- 15 = White
-
-
- Note: DCH is derived from: (D)ave's (CH)oice.
-
- [end of text]
-
- {------------------------------------------------------------------------------
-
- REVISION HISTORY
-
- v1.00 : 1993/08/25. First public release. DDA
- v1.00a : 1993/08/30. Minor tuning of .PAS code. DDA
- v1.01 : 1993/09/07. Changed program so that user -must- press one of the
- valid keys. Timeout will still default to
- the first though. DDA
- The key pressed will now only be echoed if the
- user is having DCH display a message also. DDA
-
- ------------------------------------------------------------------------------}
-
-