🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.misc
Article #3990

CHOICE keypress utility for DOS 5 [WAS: Trying to get something to work...(Batch Menu, XT utility)]

#3990
From: John Savage
Date: Fri, 04 Nov 1994 05:37
78 lines
4368 bytes
In a recent article, Justin Akehurst (akehurst@tahoma.cwu.edu) spoke glowingly
of the new CHOICE keypress utility in DOS 6, but didn't point out that it is a
supplement to DOS 6 which also runs on earlier versions of DOS, viz. DOS 5.

  >If you have DOS 6.0 and above, and you want to have an extremely powerful
  >menu program, and you aren't against using DOS aux. functions, use CHOICE.
  >
  >It provides unbuffered inputs (turbo key menu operations, no pressing
  >enter to choose your selection, just press any valid keystroke (including
  >escape and alt-??? keystrokes)), a default timeout function, a
  >user-defined prompt to say Please enter a selection or something like
  >that, and other neat and cool stuff.  It will return an errorlevel to the
  >calling batch program, which you can intercept using IF ERRORLEVEL
  >statements and executing different parts of your program by providing goto
  >statements.


The CHOICE utility is available by anonymous ftp, and runs perfectly on DOS 5.
There is another, GET_FUNC, which can be used to await a F1-F10 keypress.

ftp ftp.microsoft.com
get sup622.exe

When run on your PC, this creates about 70 files; one of these is
EXPAND.EXE and is needed for uncompressing the files you want.
e.g., expand  choice.co_  choice.com

Example: CHOICE.COM  {awaits one of the specified keypresses}
-------------------

echo   A: All the components
echo   S: Selected components only
echo   X: Exit
echo.
choice /c:asx "All, Selected, Exit "
if errorlevel 3 goto done               { keypress is x }
if errorlevel 2 goto checkdir           { keypress is s }
                                        { keypress is a }


Example: GET_FUNC.COM  {awaits function key F1-F10 keypress}
---------------------

echo Press F1 F2 F3 or F4
:get_key
get_func
if errorlevel 62 if not errorlevel 63 goto F4
if errorlevel 61 if not errorlevel 62 goto F3
if errorlevel 60 if not errorlevel 61 goto F2
if errorlevel 59 if not errorlevel 60 goto F1
goto get_key
:F4
echo That was F4 key


Usage: C:\> CHOICE /?
---------------------
Waits for the user to choose one of a set of choices.

CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text]

/C[:]choices Specifies allowable keys. Default is YN
/N           Do not display choices and ? at end of prompt string.
/S           Treat choice keys as case sensitive.
/T[:]c,nn    Default choice to c after nn seconds
text         Prompt string to display

ERRORLEVEL is set to offset of key user presses in choices.
                                                      __       __
         :--_-_-_--.  _____________________________  {  \_____/  }  __________
         | (_|_|_) |                                 {           }
      .  |  (_|_)  |                                 '~. `[ ]` .~'  Australia,
  _--_|\ |---------'      John Savage (visitor)        (.__=-- )    beautiful
 /      \|  Sydney       guest account courtesy:      _/ ~~~~~ \_   one day -
 \_.--._/^   2000         Macquarie  University      (w         w)  perfect
       v   OLYMPICS        Sydney    Australia        (         )   the next.
                                                       \__ _ __/
===========internet: johns@macadam.mpce.mq.edu.au=====  \_) (_/  =============
Technical Details
Message-ID: <39ch9s$61c@sunb.ocs.mq.edu.au>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!aggedor.rmit.EDU.AU!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!sunb.ocs.mq.edu.au!macadam.mpce.mq.edu.au!johns
References: <20469.13.uupcb@uttsbbs.ness.com> <1994Oct19.091154.1@rnis08.nut.roche.com> <3890sc$omd@tahoma.cwu.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d683,980098b9d3dc46c4,start
X-Google-Attributes: gid10d683,public
X-Google-Thread: 111d31,980098b9d3dc46c4,start
X-Google-Attributes: gid111d31,public
X-Google-Thread: f71eb,aa098bc0209fd571
X-Google-Attributes: gidf71eb,public
X-Google-ArrivalTime: 1994-11-03 21:37:00 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!aggedor.rmit.EDU.AU!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!sunb.ocs.mq.edu.au!macadam.mpce.mq.edu.au!johns
From: johns@macadam.mpce.mq.edu.au (John Savage)
Newsgroups: comp.os.msdos.misc,comp.archives.msdos.d,aus.computers.ibm-pc
Subject: CHOICE keypress utility for DOS 5 [WAS: Trying to get something to work...(Batch Menu, XT utility)]
Date: 4 Nov 1994 05:37:00 GMT
Organization: Macquarie University
Lines: 78
Message-ID: <39ch9s$61c@sunb.ocs.mq.edu.au>
References: <20469.13.uupcb@uttsbbs.ness.com> <1994Oct19.091154.1@rnis08.nut.roche.com> <3890sc$omd@tahoma.cwu.edu>
NNTP-Posting-Host: macadam.mpce.mq.edu.au