Category : Batch File Utilities - mostly for DOS
Archive   : BATMNU21.ZIP
Filename : BATMNU21.DOC

Output of file : BATMNU21.DOC contained in archive : BATMNU21.ZIP

³ º º ³±±
³ º BATMNU.EXE º ³±±
³ º Batch File Menu System º ³±±
³ º Version 2.1 º ³±±
³ º º ³±±

July 11, 1992


INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

MENU FORMAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
General Format Rules . . . . . . . . . . . . . . . . . . . . . . . . 1
Window Options . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Color Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Window Appearance . . . . . . . . . . . . . . . . . . . . . . . . . 3
Option Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Option Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Headers and Footers . . . . . . . . . . . . . . . . . . . . . . . . 4

WHAT HAPPENS IN THE BATCH FILE? . . . . . . . . . . . . . . . . . . . . . 4

MENUS WITH PARAMETERS . . . . . . . . . . . . . . . . . . . . . . . . . . 5

MOUSE SUPPORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

SHAREWARE INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . 7

BATMNU.EXE History . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Warren Small
(c) 1992


This program is a menuing system for use with your batch files. It is not
intended to be a shell, although with some very ambitious batch file
programming, it could be used as one. Its purpose is to provide sophisticated
flow control and give batch files a professional appearance by creating a
point-and-shoot menu with up to 26 options per menu. The cursor keys and the
HOME and END keys can then be used to make the selection. Each option can be
selected by a 'hotkey' defined by your menu. A mouse is also supported if

Syntax: BATMNU [d:][path]filename [label] [default]

The program defaults to an extension of "mnu" if none is provided. The
filename can be a separate file or, if you prefer, the menu can be within the
calling batch file. You will have to code the batch file so those lines are
never executed, of course. If a separate file is used, it can be 'hidden'
making it more secure from tapering.

The optional label parameter can be used if you wish to put more than one
menu within the file. Bracket your menu lines with ":label" and ":end_label".
BATMNU will search your path for the file if it's not in the current
directory. The label can be up to 15 characters long.

The default parameter on the command line is used if you want an option other
than the first one to be highlighted when the menu starts. e.g. "BATMNU
NORTON.BAT 3" will highlight the third option.


:menu {keyword to mark where the program should start reading}
header,header text
h_format,fYEL,bred,t1,d1 {header colors, time, date}
window,tRED,hWHI,... {colors and window appearance definition}
title,title text
option,option text,[#] {# indicates hotkey position in option text}
help,help text {must follow option help refers to}
option,option text,[#][,[drive],[directory],program] {optional format}
footer,footer text
f_format,fYEL,bred,t1,d1 {footer colors, time, date}
:end_menu {Program stops reading and closes the file}

- General Format Rules -

The definition can be organized in almost any order as long as it is placed
between the ':menu' and ':end_menu' keywords (or other label if provided on
the command line). The window line should appear before the options if you
use the 'l', 'n' or 'a' parameter. Maximum title length is 55 characters.

Page 1 of 8
Ver. 2.1

Warren Small
(c) 1992

Headers and footers can be 70 characters long if the time and/or date are not
used. If you leave the title out, your menu will contain only your defined
options. Header and footer are optional. Maximum option length is 50
characters for single column menus and 25 characters for double column.
Maximum help length is 70 characters.

All parameters on the window, h_format and f_format lines are separated by a
comma. Spaces are ignored. The keywords can be indented for clarity, if
desired, using spaces or TABs.

- Window Options -

The "window" line in your menu will define the colors and appearance of your
menu. The color options are:

f - foreground color of window (0-15)
b - background color of window, (0-7)
t - title color (0-15)
o - option color (0-15)
h - hotkey color (0-15)
k - screen color (clears screen), foreground (0-15) & background (0-7)
e - screen border color (0-15)

Color options should be followed by one of the color values shown in the
chart below. Hotkeys can be made invisible by using "hinv" on the window
line. The hotkeys will still select the options but the menu will not
indicate them. This gives you the look of a simpler "light bar" style menu.

- Color Values -

0 or bla = Black 8 or BLA = Grey
1 or blu = Blue 9 or BLU = Bright Blue
2 or gre = Green 10 or GRE = Bright Green
3 or cya = Cyan 11 or CYA = Bright Cyan
4 or red = Red 12 or RED = Bright Red
5 or mag = Magenta 13 or MAG = Bright Magenta
6 or yel = Brown 14 or YEL = Yellow
7 or whi = White 15 or WHI = Bright White

The 'k' option fills double duty setting the foreground and background color
for the screen. The first k parameter will set the background, the second the
foreground (Foreground default is "whi" if not specified). The foreground
color is used with the fill character. The fill character can appear after
the color of either to give the screen background more interest than a flat
color. Use of the drop shadow is more dramatic too.

If you prefer, a string could be used to fill the screen background. Either
words or special characters could be used. Put the string after the color as
above. If you want to add spaces, use the underscore (_) character. It will
be treated as a space when displayed. (e.g. kred_Main_Menu)

Page 2 of 8
Ver. 2.1

Warren Small
(c) 1992

The 'e' option sets the screen border color which is outside the normal text
area. An 'e' used alone will reset the border to its normal black.

Default colors are provided (fYEL, bblu, tWHI, oCYA, hRED) and the options
will be left-justified. The menu will be in single column format unless it
exceeds 12 options. It will have a double line frame. Default colors for
headers/footers are fWHI, bred.

- Window Appearance -

The window appearance options are:

s - shadow on, 1-4 to position shadow relative to menu
c - center each option individually
w - display menu in wide, 2 column format, default for > 12 options
l - default to letter selection of options
n - default to number selection of options, maximum of 10 options
a - automatic selection of hotkeys
m - menu frame type, 1 - ÚÄ, 2 - ÉÍ, 3 - ÕÍ, 4 - ÖÄ, 5 - Ûß
~ - Allows use of the Escape key to exit menu, returns errorlevel 0
x - Do not check for mouse

The 'l' option can be useful when you have a large number of options or if
you just prefer it that way. The 'n' option is for those who prefer numbered
menus. The 'c' option is overridden if you use 'l' or 'n'. With these
options, your maximum option length is reduced by 3 characters and the hotkey
will be set to 1. If you follow the 'l' or 'n' with another character such as
a dash, period or parenthesis, this will be used as a separator. (e.g. 'l-'
will produce 'A-', 'B-', etc for the menu.)

The shadow position is set with the 's' option. 1 is below and to the right.
2 is below and the to left. 3 is above and to the right. 4 is above and to
the left. The 's' option alone defaults to 1.

- Option Lines -

Hotkey position starts at 1 and will default to that position if omitted or
the number is longer than the text. Alternately, the hotkey can be defined
with a character. BATMNU will first search the option text for an uppercase
letter that matches. If there is no uppercase match, the program will do a
lowercase search for the first character that matches. (e.g. "Disk Info,i"
will highlight the I of "Info". "Disk Filer,i" will highlight the i in
"Disk") Use a number if you want a specific character as your hotkey.

If a hotkey character is duplicated, the menu will return the value
associated with the first option with that hotkey if the hotkey is pressed.
If the highlight bar is used to select an option with a duplicate hotkey
value, the highlighted option value will be returned.

You can let BATMNU select the hotkeys, if you wish, with the 'a' window
parameter. The choices can be overridden by the option line selection. The

Page 3 of 8
Ver. 2.1

Warren Small
(c) 1992

menu will default to letter choices if it runs out of characters to pick
from. This procedure will also favor uppercase characters before lowercase.
To override this, use 'an' (auto hotkey, no case).

If the program cannot find any options in the file, a Menu Format Error
message will be displayed.

- Option Help -

The Help line specifies text which will appear in the footer (See below.). It
can be up to 70 characters long and can appear with the time and date. This
will restrict the help line length some, depending on the time/date format
used. The help must follow the option it refers to creating option/help pairs
in the menu. e.g. "option,Norton Commander" could be followed by "help,File

- Headers and Footers -

The header and footer items define a line of text to appear at the top and
bottom of the screen. The entire row will be colored with the background
color. Colors are defined on the h_format and f_format lines using the f and
b parameters as shown above. See below under Window Options for more
information on colors.

The time and date can appear in the header and / or footer. On the format
line(s) include a 't' for time and 'd' for date followed by a number
indicating the format to use. They are as follows:

0 - HH:MM:SS (default) 0 - MM/DD/YY (default)
1 - HH:MM:SS am 1 - MM/DD/YYYY
2 - HH:MM am 2 - DDD MMM DD, YYYY
3 - HH.MM.SS 3 - DD/MM/YY
4 - HH.MM 4 - DD/MM/YYYY

The date will appear to the left of the header or footer and the time will
appear to the right. If the header/footer is too long, the time and date
information could overwrite it. A footer can be combined with help (See
above.) with the help line given precedence. If an option has no help line,
the footer is displayed.


If you execute the sample batch file, NORTON.BAT, you will see a menu
displaying several choices. If you choose one of the options, you will
probably see a lot of DOS error messages as the chance of your computer being
setup the same way is negligible. When you view the batch file, you can get a
good idea how BATMNU operates.

The menu is near the beginning of the batch file mainly for speed. You will
notice a "GOTO START" statement which causes the batch to branch around the
menu. After the ":START" label is the command line that calls BATMNU and

Page 4 of 8
Ver. 2.1

Warren Small
(c) 1992

tells it what file the menu is in. If this file is not in your PATH or in the
current directory when started, you would need to specify the full path name.

DOS ERRORLEVEL is set on exit from BATMNU with level 1 corresponding to the
first option, etc. A series of "if errorlevel x goto ..." statements after
the line calling BATMNU will allow the batch file to determine which option
was selected and branch to the appropriate label. A level 0 is set whenever
the program encounters an error (file not found or parameter error) so you
should plan your batch file accordingly. If the Escape key option is used,
this will always return a level 0. Be sure to order your errorlevel
statements from largest to smallest since "if errorlevel 3" will be true for
EL=3 or greater. See your DOS manual for more information.

Executing BATMNU with no parameter will display a help screen and example
menu. If you type the command "BATMNU NORTON.BAT" from the DOS prompt, the
menu will be displayed as before but nothing will happen when you make a
choice. You need to run the batch file itself to get anything to start. Three
example files are included in this archive, one showing a separate menu file,
another a menu within a batch file, and a third detailing a menu with
parameter passing.


Optionally, a program can be started directly from BATMNU. This will result
in shorter batch files as minimal ERRORLEVEL checking is necessary. You will
also find the programs will start faster since there is no batch file
processing. The option line contains additional information relating to the
drive, directory and program name is this form:

option,Word Perfect,w,c:,\wp51,wp

BATMNU will change the drive and directory and start WP when this option is
selected. When WP is finished, you are returned directly to your batch file.
BATMNU sets an environment variable, ERRLEV, to identify the program run. You
may wish to do further processing based on the program run or you can check
for an ERRORLEVEL code returned from that program. The ERRLEV variable will
equal the number of the option picked. If WP was the third option, ERRLEV=3
would be in the environment. You could then run an automatic backup procedure
for WP with the line "if %ERRLEV%!==3! goto wpbackup".

Additional parameters can be passed to your program. Simply include them
after the program name as you normally would.

option,Paradox - Phones,11,e:,\paradox\phones,paradox3 phone.scr

This line would start Paradox which would then run the script phone.scr. It
is recommended that your batch file clear the ERRLEV variable at the
beginning and end to preserve space and prevent your batch file from acting
on old information in the environment. The statement "SET ERRLEV=" will do

Page 5 of 8
Ver. 2.1

Warren Small
(c) 1992

If there are no parameters on a line, you can use BATMNU the same way as
earlier versions and the ERRLEV variable will not be set. If you want to
leave out the drive and/or directory parameters, leave a comma to mark it.
BATMNU will assume the program can be found in your PATH. If you don't use
any parameters for an option, the placeholders are not necessary. See the
files NORTONP.BAT and NORTON.BAT in this archive for a comparison.

IMPORTANT NOTE: DOS 3.3 or higher is required if you want to use parameters
on the option lines. This requirement is necessary so that BATMNU can use the
environment to relay information back to the batch file. BATMNU will display
an error message and return an EL=0 if you are not using the proper DOS

Page 6 of 8
Ver. 2.1

Warren Small
(c) 1992


When BATMNU is run, it checks for a mouse unless the 'x' parameter is found
on the "window" line. This switch will cause BATMNU to not use the mouse.
Once the mouse is detected, the mouse cursor will be set next to the first
option. The delay you will observe after the menu is displayed and before the
highlight bar appears is the mouse initializing and is normal.

Options can be selected with the mouse by moving the cursor to the option
line and clicking the left button. If the option is currently highlighted,
BATMNU acts as if the hotkey was pressed. If not, only the highlight bar is
moved. A second click will then select that option.


This program is provided as "shareware". You are allowed to use it, free of
charge, for a reasonable amount of time. If you find BATMNU to be useful, and
continue to use it, a registration fee of $15 is required. A form is supplied
with the ZIP file to register with (BATMNU21.REG). Paying this fee will
encourage me to make improvements and/or correct problems for future
versions. Registered users will receive notification of future releases and
how the new version can be obtained. It will also give their ideas for
improvements more value.

*** NEW PROGRAM! ***

Upon receipt of the registration fee, a disk will be sent with the current
version plus the program SW-DIR.EXE. This program provides a scrolling file
directory which can be used to choose a file and pass that filename to an
application or use it in your batch file. Appearance options are similar to
BATMNU. The program includes a ZipSearch feature which can quickly locate a
file by name. DOS 3.3 or higher is required to use this program.

Site licenses for BATMNU can be negotiated. Registered 1.X users can upgrade
to 2.1 for $5. Feel free to give it to friends or upload the original ZIP
file to other BBS's provided that no fee is charged for distribution and it
is not modified in any way. Note to BBS Sysops: Please post this ZIP as is,
with all files included, and without changing the ZIP filename.

Ver. 2.1 July 11, 1992

Warren Small CIS 71076,407
35 Benjamin Street GEnie W.SMALL
Manchester, NH 03109 Prodigy RSJW31A

Page 7 of 8
Ver. 2.1

Warren Small
(c) 1992


1.1 02/02/90 First general release.

1.2 03/15/90 Options increased to 26. Added automatic hotkeys and hotkey
choice by letter.

1.3 04/22/91 Added numbered options, menu frame choices, invisible hotkeys.

2.0 09/30/91 New option line format to start programs directly. Added mouse
support, screen border color control, screen foreground color control, header
and footer option, shadow position control, letter and number separator.

2.0a 01/31/92 Maintenance release fixing several bugs. Parameters now passed
properly to programs started by BATMNU. Border color set properly. Default
colors provided for header and footer. Header and footer documentation

2.1 07/11/92 Added time/date options to header and footer. Header and footer
string length increased to 70. Default menu choice can be specified on
command line. Corrected action of menu with duplicate hotkeys. Hotkey
selection by letter favors uppercase match in option text. Option string
length increased to 50 for single column menus. Help line option added.
Background string fill added (k#string).

Page 8 of 8
Ver. 2.1