Dec 092017
 
MYMENU -- Creates totally customizable menus for batch files.
File MYMENU.ZIP from The Programmer’s Corner in
Category Batch Files
MYMENU — Creates totally customizable menus for batch files.
File Name File Size Zip Size Zip Type
MYMENU.DAT 140 128 deflated
MYMENU.EXE 10336 6286 deflated
MYMENU.TXT 5567 2299 deflated
TEST.BAT 17 14 deflated

Download File MYMENU.ZIP Here

Contents of the MYMENU.TXT file


MYMENU -- Creates totally customizable menu for batch files.
Selections set Errorlevel for future processing. By Brian E.
Smith.

One of the slickest ideas I've seen in a while was
encompassed in a program called "BMENU" by Mark Strong. A friend
of mine at work got this off of the DataCom SuperSystems bulletin
board out of Tampa, FL (highly recommended: (813) 796-5627).
This program was loosely based on Norton's ASK command. On the
command line, you were able to specify menu position, title, and
menu choices. Selecting one of them would set the Errorlevel,
which could then be processed while running from a batch file.
This program would work fine with small menus, but inadequacies
become apparent when you need to make a larger menu, or if you
want to change his color scheme.

My program, MYMENU, will display a menu that the user
specifies with a special data file. This is an ordinary text
file containing special commands to configure your menu. You are
able to specify colors, title, position, and menu items. When
this is run from a batch file, the batch processing will be
paused, the menu will be placed on screen, and the user will be
able to use the cursor keys to select a menu item. MYMENU will
set the errorlevel according to the choice the user made: the
first menu item returns errorlevel 0, the second returns 1, third
returns 2, etc. The batch file may test errorlevel and continue
processing based upon the user's selection. Errorlevel testing
must be done from the highest possible value and work down to 0;
that is, if my menu had 4 choices, it would return errorlevels of
0 to 3. In the batch file, you must first test errorlevel 3,
then 2, 1, and 0.

The menu data file allows you to specify menu colors, title
text, menu position, and menu items. This is the format for the
data file:

color and position commands...
menu_begin
menu title text
menu item text

The keyword "menu_begin" must be specified between the
color/position commands and the menu title text. Color/position
commands are optional, however "menu_begin" is mandatory, as is
the menu title text. You may have as many menu items as you
wish.

The position command is used to specify the position of the
menu. The position specified tells MYMENU where to place the
upper left corner of the menu. The format of the command is:

POSITION ,

where and are screen coordinates, with
mapping to the upper left corner of the screen.

Color commands allow you to change the default color set,
giving you control of both foreground/background colors for the
menu title, regular menu items, the selected menu item, the
border, and the shadow. The color commands are specified as
follows:
,
where is one of the following: TITLE, ITEM,
SELECTED, BORDER, or SHADOW; is one of TEXT or
BACKGROUND; and is one of BLACK, BLUE, GREEN, CYAN, RED,
MAGENTA, BROWN, LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN,
LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, or WHITE. I chose a
fairly conservative default color scheme, and if you don't
specify any color commands, you'll get my default colors. By
using these commands you can make your menu as psychedelic as you
want. If MYMENU doesn't recognize a color command, it will be
ignored.

The first line after the "menu_begin" keyword is the menu
title. It can be up to 64 characters in length, and it will be
displayed at the top of your menu.

The remaining lines after the menu title will be selections
in the menu. When the menu is displayed, the first item will be
highlighted, and the user will be able to scroll through the
choices using the cursor keys. The first item displayed will
return errorlevel 0 if selected, the second item will return 1,
etc.

Here is a menu data file that I have on my machine at work.
I like my default colors, so I leave the colors alone:

position 9 26
menu_begin
Hello Brian
Lotus 1-2-3
Paradox 3.0
Pfs: Professional Write
Turbo C 2.0
Turbo Pascal 4.0
Exit to DOS

This is an excerpt from the driving batch file:

@ECHO OFF
GOODDAY
MYMENU C:\DOS\BATCH\MYMENU.DAT
IF ERRORLEVEL 5 GOTO QUIT
IF ERRORLEVEL 4 GOTO TURBO
IF ERRORLEVEL 3 GOTO TURBOC
IF ERRORLEVEL 2 GOTO PW
IF ERRORLEVEL 1 GOTO PARADOX
IF ERRORLEVEL 0 GOTO LOTUS
GOTO QUIT
...

To run the program, type MYMENU , where is the
name of your menu data file. I've included a copy of my own menu
data file (which should be included in the distribution package
you received), so you can get a feel for MYMENU.

You have my word of honor that there are no uglies (viruses,
trojan horses, etc.) in my program. I have absolutely no desire
to destroy another one's work or property. Please pass this
program along to others, even if you don't like it, because
someone may like and need it. Thanks.

Brian E. Smith
59 Main Street
Piedmont, SC 29673





 December 9, 2017  Add comments

Leave a Reply