home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
batch
/
batbox26.zip
/
BATBOX.DOC
< prev
next >
Wrap
Text File
|
1992-04-08
|
17KB
|
428 lines
STEENBURGH'S STUFF
Mildly Useful Utilities
For Batch Files
Version 2.0
Copyright 1991,1992 by Chuck Steenburgh and Tay-Jee Software
_______
____|__ | (TM)
--| | |-------------------
| ____|__ | Association of
| | |_| Shareware
|__| o | Professionals
-----| | |---------------------
|___|___| MEMBER
Page 1
BATBOX.EXE 2.6 |
Copyright 1991 by Chuck Steenburgh and Tay-Jee Software
People have been creating menus with batch files for
years. Some of these are quite elaborate, others very crude.
BATBOX is something in between. BATBOX will allow you to
display an attractive, colorful menu and will wait for
the user to make a selection. It will then set an appro-
priate ERRORLEVEL value which can be used to determine sub-
sequent actions in your batch file.
Usage: BATBOX menufile [/C] [/Dn] [/Tn] [/Wn] [/H] |
[/O] [/Q] [/Pn] |
menufile is the name of an ASCII text
file which you create. This
will contain the menu's title
and a list of options.
/C Normally, the longest menu item
is centered in the menu box and
subsequent items are left-aligned
below it. This switch will cause
each menu item to be centered in
the menu box.
/Dn Date format. Current valid values
for n are:
1 European style (YY.MM.DD)
2 Short month (DD Mmm YY)
3 Weekday (Www MM DD)
- Turn off date display
/Tn Time format. Valid values for n are:
1 Display time using 12-hour
clock with AM/PM
2 24-hour clock, no seconds
3 12-hour clock, no seconds
/Wn Exit menu if no keys are pressed with-|
in n seconds and return errorlevel of |
255. |
/H Generates help screen.
/O Ordinal menu selection. Instead
of returning an errorlevel based
on the hotkey, returns an error-
level based on the ordinal pos-
ition of the selected menu item.
/Q Quiet mode suppresses all sounds.
Page 2
/Pn Select predefined color palettes: |
1 - Ice Blue |
2 - Fire Red |
3 - Pastel |
4 - Monochrome |
To create a menufile, use a text editor, word processor that
can save ASCII files, or EDLIN.COM or EDIT.COM that come with
DOS. In a pinch, you can use the "copy con" command but this
doesn't give you much in the way of an editing capability.
The structure of the menufile is simple. The first line
contains your menu's title, up to 60 characters. If you
don't want a title, leave the line blank, without any spaces.
(Hint: press RETURN immediately without doing anything else
when you first begin editing your document.) Each succes-
sive line contains a menu item, exactly as you want it to ap-
pear on the screen. Do NOT include any blank lines here or
you will end up with blank lines in your menu!
A few limitations: each line can contain no more than 60
characters (if you need more than this to describe your menu
choices, maybe you need Microsoft Windows, a Macintosh, or
something else with lots of pictures!). In addition, your menu
items (but NOT the menu title) should each begin with a dis-
tinct letter in order for the selection function to work pro-
perly. The selection function for BATBOX is case-insensitive,
so if you begin one line with the letter 's' and the other
with the letter 'S', these are considered the same. Up to
10 menu items are permitted in any one file.
When you type BATBOX on the command line followed by the
name of your menufile (they must both be in the current dir-
ectory), you will see a menu pop up in the middle of the
screen. The title will appear at the top, with each of your
menu items (up to ten) appearing at double spaced-intervals
inside the menu box. Each item will also be numbered from 1
to 0 (the 10th item being numbered "0"). At the bottom of the
menu you will see a the message "Enter your menu choice: ".
If you have a color monitor, you will notice that the first
letter (the "hotkey") of each menu item appears in a different
color than the rest of the text. The time and date will also
be displayed at the top of the menu.
There are now three separate methods of selecting a menu
item. The first is by pressing the hotkey described above.
The second is by pressing the item number displayed to the left
of each menu item (1-0, with 0 representing item 10). The
third method, new since Version 2.5, is by positioning the cur-
sor bar over the appropriate menu item and pressing ENTER. Use
the up/down cursor arrow keys to move the bar up and down. You
may also use the PgUp key to position the bar over the first
menu item and the PgDn key to position it over the last menu
Page 3
item. PRESSING ANY OTHER KEY will produce an error tone (un-
less the /Q switch is specified) but otehrwise do nothing.
After selecting a menu item in one of the ways above, BATBOX
will then exit, and return an errorlevel based on the hotkey.
See Appendix 1 for a list of legal first letters and the error-
levels that are returned by BATBOX. If you select the /O op-
tion, BATBOX will return the position of the selected menu item
via the errorlevel. For example, if you select the 1st item on
the list and have specified /O, the errorlevel will be set to
1. If you select the 5th item, the errorlevel will be 5, and
so on. You can use the errorlevel value that is returned to
branch to different parts of your batch file or to execute
commands. See the DEMO.BAT file for an example of one way to
do this. (DEMO.BAT is part of the STUF??.ZIP archive which
contains demonstration files for all of the STEENBURGH'S STUFF
utilities).
The errorlevel that is returned is affected only by the /O
switch, and NOT by whether the item is selected via the hotkey,
the item number, or the cursor bar.
If you enter BATBOX alone on the command line without any
parameters, the help screen will be displayed.
Customizing Colors
Beginning with version 2.1, BATBOX users can customize their
menu's colors by using a small text file called BATBOX.CFG.
Using the color codes from Appendix 3 of STEENBURGH'S STUFF
documentation, enter a color value into a text file for the
following items, one entry per line:
Line # Controls Valid Values
====== ======== ============
1 Menu color 1-127
2 Menu border type 1-4
3 Menu shadow pattern 1-3
4 Menu title color 1-255
5 Menu interior color 1-127
6 Menu item color 1-255
7 Hot key color 1-255
8 Cursor bar color 1-255
9 Prompt message color 1-255
10 Date/time color 1-255
See the enclosed file BATBOX.CFG for an example. The 5 pre- |
defined color palettes (one default and four selectable with |
the /P switch) are shown below. |
PREDEFINED COLOR PALETTES |
0 1 2 3 4 |
===== ===== ===== ===== ===== |
Page 4
Menu color 79 27 78 53 112 |
Menu border 2 1 1 1 1 |
Menu shadow 2 3 2 3 2 |
Menu title 79 27 116 95 14 |
Menu interior 31 27 64 48 0 |
Menu item 79 27 116 53 7 |
Hot key 30 31 79 63 14 |
Cursor bar 14 49 78 95 112 |
Prompts 31 27 116 61 7 |
Date/time 113 27 124 53 7 |
OMBUDSMAN
This program is produced by a member of the Association of
Shareware Professionals (ASP). ASP wants to make sure that
the shareware principle works for you. If you are unable to
resolve a shareware-related problem with an ASP member by
contacting the member directly, ASP may be able to help. The
ASP Ombudsman can help you resolve a dispute or problem with
an ASP member, but does not provide technical support for
members' products. Please write to the ASP Ombudsman at 545
Grover Road, Muskegon, MI 49442 or send a CompuServe message
via CompuServe Mail to ASP Ombudsman, 70007,3536.
DISCLAIMER
The programs described in this documentation are guaran-
teed to do absolutely nothing! They have, however, in my exper-
ience performed essentially as described herein. The author
will not be responsible for any loss or damages caused through
the use of these programs. No warranty, express or implied,
is provided for this software's performance, merchantability,
or fitness for a particular purpose.
All trademarks are property of their respective owners.
The programs and documentation are Copyright 1991,1992 by
Chuck Steenburgh. You are encouraged to distribute these pro-
grams provided the following conditions are met:
- all files contained in the archive or distribution disk
must be distributed together in UNMODIFIED form
- you charge no more than a reasonable fee for copying or
subscription, and clearly indicate that payment of such
a fee does NOT grant ownership of the programs.
This program is part of set of utilities known as STEEN-
BURGH'S STUFF (Mildly Useful Utilities). The full set of
utilities includes the following programs:
BATBOX: Simple menu creation/input system
Page 5
CHKPRN: Checks parallel printer status
CLK: Displays time on screen
CURSOR: Change cursor shape
DOSVER: Checks for DOS version currently running
INPUT: Simple prompt/input system
KLS: Colorful screen-clearing utility
LAUNCHER: File selection/execution system
MUSIC: Plays transcribed sheet music on the PC
RAND: Random number generator
SKIP: Prints blank lines from batch files
SOUNDER: Wide range of noise making options
SPACE: File/disk space reporting utility
WAITFOR: Timed pauses
WHENISIT: Date/time telling utility
WRITE: Colorful output anywhere on screen
XD: Create/switch directories at the same time
You may evaluate these programs for up to 30 days on a free
trial basis. After 30 days, you should register your use of
these programs. The registration fee is $20, payable to the
author at the address given below. For those registering
directly with Tay-Jee Software, we offer a $5 cash discount.
Let's be real: I don't plan to make alot of money this way.
Registration does have its advantages:
- I am improving these programs all the time. Registration
will get you IMMEDIATELY a disk with the latest version.
You will also get the next major release of the program set
sent to you free of charge.
- While I can't promise to include everyone's suggestions
in program updates, you can bet I'll listen to registered
users before any of you scrounges out there.
- You will make me feel all warm and fuzzy and appreciated,
and all that good stuff.
- You will also get an evaluation copy of my text-file for-
matting program (used to produce the margins in this doc-
ument), and any other electronic creations I have decided
to unleash on a foolish, unsuspecting world.
Send comments/registrations to:
Tay-Jee Software
Post Office Box 835
Lexington, VA 24450
(703)464-5290
!!!VIRGINIA RESIDENTS ADD 4.5SALES TAX!!!
CIS 72330,1776 (I haunt the IBMSYS and IBMPRO forums)
Page 6
Page 7