======================================================================= Enquire 2.5 (c)1994 Robert Rothenburg Walking-Owl ======================================================================= This software may be used and/or copied by individuals and institutions so long as this program is neihter modified not sold for profit. It is provided "as is" with no warrantees or guarantees of any kind. Enquire allows DOS batch files to be interactive-- a question is shown, user input accepted and an exit code is returned. With Enquire, you can ask Yes or No questions, use menus or even input environment variables. For example, I use the following in my AUTOEXEC.BAT file: Enquire -s -d "Do you want to load ANSI.SYS?" If errorlevel 2 devlod c:\bin\ansi.sys [..] Enquire -s "Do you want to run Windows?" If errorlevel 2 WIN I use the same for a few other drivers in my system. Rather than up- grading to DOS 6 or using several boot disks for each configuration, I can choose to load whatever drivers I need each time. (BTW, "devlod" is a utility by Jim Kyle from Dr. Dobb's Journal, November 1991, which loads drivers from the command line rather than maintaining several CONFIG.SYS files...). Enquire has these modes of interaction: o Yes or No questions (default) o Outputting a message only o Returning an ASCII code or number o Inputing environment variables The first mode is the simplest and probably the one used most. The others are 'frills' added in version 2.5. ======================================================================= What the options mean: ======================================================================= -a Output is sent to the DOS FastPutChar function (Int 29h) rather than to STDOUT, and is not redirectable. -c Clears the keyboard buffer before waiting on a key. -d If the user hits a key other than 'y' or'n', or if the wait times out, Enquire assumes No unless the -d option is used, then Yes is assumed. -e By default, Enquire echoes a "Yes" or "No" when a key is pressed. This option tells Enquire to show only the key pressed. -f If no message is given, Enquire will return an error. This option forces Enquire to wait for a response instead. -h Help (same as -?). -i Initializes all the flags to defaults. Used to disable most options (except the -t, -y or -n) set in the ENQUIRE variable. -k Enquire will accept any key, but assume if it is not a 'y' or 'n' key, it is the default (usu. 'n'). This option tells Enquire to accept only a 'y' or 'n' response. -l By default, Enquire reads the response directly from the keyboard. The -l option tells Enquire to read from STDIN, and hence the user must hit ENTER after the response. -n See the -y option. -q By default, Enquire echoes a "Yes" or "No" when a key is pressed. This option tells Enquire to show nothing. -r Reverses the exit codes. By default, Enquire returns a 0 for No and 2 for Yes (1 always means an error in usage). The -r options returns 2 for No and 0 for Yes. -s The keys expected (Y or N) are shown after the query mess- age, in parenthesis, with the default key capitalized. -t s By default, Enquire will wait ten seconds for a response. This option tells Enquire to wait 's' seconds, ie. -t 20 (Any value between 0 and 59 is acceptable). -w By default, Enquire will wait ten seconds for a response. This option tells Enquire to wait forever. -x Instead of returning a 0 or 2 for No or Yes, the ASCII code of the key pressed (lowercase) is returned. -y "c" By default, when the 'y' key is pressed, Enquire shows "Yes". This option redefied the Yes key and what is shown instead, ie, -y "Si" for Spanish users accepts 's' as Yes and shows the word "Si". The -n option works the same for No. -z Enquire will not wait for a response, but simple output the message. -# Enquire will input a number from the line and return that number as the exit code. "string" The is the response string, which should follow all the options. All the strings must be in double-quotes, and can use most ANSI C escape codes: \a = audible bell (ASCII 07) \b = backspace \f = formfeed \n = newline \r = carriage return \t = horizontal tab \v = vertical tab \nnn = ASCII code (in decimal) ie., \254 \0nnn = ASCII code (in octal) \0324 \0xHH = ASCII code (in hexidecimal) \0xfe \0bxxx = ASCII code (in binary) \0b11111110 For a full DOS newline, use "\r\n" or "\n\r". Note that these codes *are* case sensistive! ,var To input an environment variable, follow this after the query string, ie., ENQUIRE "New Path: ",PATH (If you hit ENTER and input a blank line, the variable will be undefined!) Here's a nifty trick, though. Let's say you want to add the directory C:\API to your path: Enquire -z $PATH ";C:\\API\r\n" |Enquire -f ,PATH ^^^ Remember the carriage return!!! $var This outputs an environment variable, ie., ENQUIRE -Z $PATH or ENQUIRE -Z "The Path is: $PATH" ======================================================================= Miscellania ======================================================================= It's best to play around with Enquire. Since it doesn't change anything (unless you use the ,var option) it's safe to play around. Make sure you've verified that the options are Ok if you are using Enquire for a utility that can be damaging if mistakes are made. Take a look at the enclosed batch files with this archive to see some examples. If you have any requests, comments or bug reports, please e-mail me at the following address: -+------------------------------------------------------------------+- Robert Rothenburg Walking-Owl (Freelance Writer/Journeyman Programmer) From somewhere in the cybernetic ether: -+------------------------------------------------------------------+- "Is it a surprise that prisons resemble factories, schools, barracks, hospitals, which all resemble prisons?" --Michel Foucault -+------------------------------------------------------------------+- I am not a number, I am a PGP-Key: 97BE7067 65AB82F1 13A2E88D 9C31E906 -+------------------------------------------------------------------+- Finger for Public-Key(s).