home *** CD-ROM | disk | FTP | other *** search
-
- Select
- Making your batch files more useful.
-
- Here it is, a simple program that allows you to ask questions in
- your batch files. This program was originally written for use in a
- large batch file for external protocols for Qmodem. Since Qmodem
- only supports 8 externals I wrote this program to allow one batch
- file then do everthing from this batch file, also saves on disk
- space and the constant hassle of changing the configuration of
- Qmodem to use a different protocol. Oh well enough of that, here is
- how to use Select........
-
- The command line is as follows...
- Select ABCDGER
- Thats it. sounds simple, well there's more to it than that.
- In your batch file you would echo or type a file that displayed to
- the user the choices that they had, for example a menu system.
-
- echo off
- echo Welcome to my menu.
- echo [A] Qmodem 4.2d
- echo [B] Shez 5.7
- echo [C] TheDraw
- Select ABC
-
- ok so far we have the first part of our batch file, we have echoed
- or printed our choices to the screen, now comes the decision making
- part of Select. The "ABC" after Select tells it that the only valid
- choices for this menu are A,B, and C. Select will display the
- prompt "Selection ? " and wait for a key to be pressed. If a wrong
- key is pressed it will not accept it and display a message saying
- so. If a valid key is pressed, Select will then exit and set the
- DOS errorlevel corresponding to the placement in the list of valid
- keys. So in our example, A would exit with an errorlevel of 1 and
- B would exit with 2, and so on. But what if you don't want to use
- A,B, or C in menu, then don't. Say our menu was changed to....
-
- echo off
- echo Welcome to my menu.
- echo [Q] Qmodem 4.2d
- echo [S] Shez 5.7
- echo [T] TheDraw
- Select QST
-
- Then Q would be errorlevel 1, S would be 2, and T would be 3.
-
- Select <letters, numbers, or any single keystroke>
- exit codes run from left to right with the first one being 1.
- Also, pressing the ESC key will exit with a errorlevel of 0, this
- is to allow some escape from Select as Ctrl-C does not terminate
- most EXE files.
-
- Here is an example of a complete BAT file using Select.
- ───────────────────────────────────────────────────────────────────────────
-
- echo off │ Turn command echo off
- :START │ This is where it will loop back
- cls │ Clear the Screen
- echo Welcome to my menu. │ Display the menu using echo
- echo [Q] Qmodem 4.2d │ you could make a drawing in ANSI
- echo [S] Shez 5.7 │ and use the TYPE command to
- echo [T] TheDraw │ display it.
- echo [ESC] goto DOS │
- Select QST │ Call Select with Keys Q,S, T
- if errorlevel 3 goto TDRAW │ Remember, Select will return 1
- if errorlevel 2 goto SHEZ │ for Q, 2 for S, and 3 for T. And
- if errorlevel 1 goto QMOD │ you must check for them in reverse
- if errorlevel 0 goto END │ order beause of the way DOS looks
- │ at errorlevels. The 0 is for ESC.
- :TDRAW │ Here is the first label. We will
- cd\thedraw │ change the current directory to
- thedraw │ TheDraw and run this fantasic
- cd\ │ ANSI drawing program. After your
- goto START │ done it will loop back to START
- │ and start all over. The rest of
- :SHEZ │ the BAT is to run other programs
- cd\shez │ or what ever you decide to do.
- shez │
- cd\ │ Here's SHEZ, a great ZIP, ARC, ZOO
- goto START │ LZH shell. Makes thing easy on you.
- │
- :QMOD │
- cd\qm │ And of course, here's my favorite
- qmodem /stats │ communications program. Qmodem
- cd\ │
- goto START │
- │
- :END │ The last label is for the ESC key
- CD\ │ so you can exit your batch menu
- CLS │ and goto DOS
-
- ───────────────────────────────────────────────────────────────────────────
-
- Select can handle up to 50 different keys on the command line.
- You can use $#@!^&*() if you like, just remember not to duplicate
- keys because your batch will most likely do the wrong thing.
-
- Since this is the first thing that I have ever released into the
- public I will not ask for any registration fees. This one's FREE.
- In the future I will update Select to do many more things, like
- command line color selection and prompts, also a placement scheme
- so you can put your prompt anywhere on the screen that you want.
-
- Last but not least, If Select decides not to work or break let
- me know. However I cannot be held responsible for any damage that
- it does. Select has proven to work on my machine and a few others
- and it does not contain any destructive code.
-
- If you have any questions I can be reached at one of the
- following BBS's.
-
- The Brazorian BBS
- Sysop James Kennemer
- 300/1200/2400
- (409)798-0905
-
- The Richwood BBS
- Sysop Carl Henderson
- 300/1200/2400
- (409)265-5958
-
- Leave a message to Carl Henderson on any of the message boards
- and I will try to respond to it within a couple of days. You
- can also write to me at this address.
-
- Carl Henderson
- 302 N. Mahan
- Richwwod, TX 77531
-
- That's it ... Have fun...............................................
-
- THE END
-
-