home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
terabyteunlimited.com
/
2014.06.terabyteunlimited.com.tar
/
terabyteunlimited.com
/
MSGBOXT.ZIP
/
README.TXT
< prev
next >
Wrap
Text File
|
2006-05-03
|
5KB
|
152 lines
Description
~~~~~~~~~~~
MSGBOX is a simple DOS utility to display a message box and wait for
input from the user. You would typically use this in a batch file
with ERRORLEVEL to determine the user's response.
Installation
~~~~~~~~~~~~
Besides the batch file(s) themselves, using MSGBOX requires at least
two files: MSGBOX.EXE and MSGBOX.TXT. MSGBOX.EXE is the program
itself, and MSGBOX.TXT is the file used to store the message to be
displayed to the user. More information on the function of MSGBOX.TXT
is provided in the Usage section below.
Place MSGBOX.EXE and MSGBOX.TXT in one or more folders on your hard
drive, or on a floppy diskette, depending on what path(s) will be
accessible when you run MSGBOX.EXE from your batch file.
Note: When MSGBOX.EXE is run, it looks for MSGBOX.TXT in the current
directory of the DOS environment. Therefore, MSGBOX.EXE and MSGBOX.TXT
need not be in the same folder, and you may use multiple copies of
MSGBOX.TXT, if desired.
Usage
~~~~~
Please refer to the MSGBOX.TXT and SAMPLE.BAT example, which is
included in this package.
MSGBOX.TXT is used to specify the message to be displayed to the user.
MSGBOX.TXT can optionally be used to specify the colors of the message
box dialog as well.
To set up MSGBOX.TXT, simply enter the text that is appropriate for the
question being asked of the user, and list the valid response characters.
You can enclose a string in a pair of ~ characters to highlight text.
The colors of the message box, message box text, and input area can be
specified in MSGBOX.TXT. To specify colors, use the following format,
and put the line at the top of MSGBOX.TXT:
%box%=0xFFFF %text%=0xFFFF %input%=0xFFFF
Each FFFF represents the applicable character's normal and highlight
colors. The list of available colors is as follows:
Black ........... 0
Blue ............ 1
Green ........... 2
Cyan ............ 3
Red ............. 4
Magenta ......... 5
Brown ........... 6
Light Gray ...... 7
Dark Gray ....... 8
Light Blue ...... 9
Light Green ..... A
Light Cyan ...... B
Light Red ....... C
Light Magenta ... D
Yellow .......... E
White ........... F
Command line format for MSGBOX.EXE:
MSGBOX chars
Where "chars" represents a string of valid response characters. Note:
Be sure to specify the valid response characters in MSGBOX.TXT,
according to what you use in the MSGBOX.EXE command line.
ERRORLEVEL is set to a number that equates to the position of the
character that was entered. Numbering begins at 1. For example, if
the characters supplied were YNC (i.e. a command line of "MSGBOX YNC"),
then pressing Y would set ERRORLEVEL to 1, pressing N would set
ERRORLEVEL to 2, and pressing C would set ERRORLEVEL to 3.
Note that for any n value that ERRORLEVEL is set to, ERRORLEVEL n-1
will also be true. For example, if ERRORLEVEL is 4, then testing it
against 3, 2, 1, and 0 will also be true. For this reason, you must
always test ERRORLEVEL in reverse order. For example:
if errorlevel 3 goto :error3
if errorlevel 2 goto :error2
if errorlevel 1 goto :error1
If you were to evaluate ERRORLEVEL the other way around, then the batch
file would branch to the :error1 label, even if ERRORLEVEL were equal
to 2 or 3.
Additional Usage Information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you wish to use MSGBOX more than once, there are a couple different
ways you can make it work:
1. You could keep separate customized copies of MSGBOX.TXT in different
folders, and change the current directory before invoking MSGBOX.EXE,
to point to the correct MSGBOX.TXT. For example:
@echo off
cd YNCdir\
..\msgbox ~YNC~
if errorlevel 3 goto :cancel
if errorlevel 2 goto :no
if errorlevel 1 goto :yes
cd ECdir\
..\msgbox ~EC~
if errorlevel 2 goto :continue
if errorlevel 1 goto :exit
The example above assumes that the files YNCdir\MSGBOX.TXT and
ECdir\MSGBOX.TXT each exist. It also assumes that the labels called
(i.e. :cancel, :no, :yes, :continue, and :exit) exist elsewhere in the
batch file.
The "..\" is used when MSGBOX.EXE is invoked because of the assumption
that MSGBOX.EXE resides in the initial current directory. For example,
if you began in A:\ and issued the command "cd YNCdir\", issuing the
command "..\msgbox ~YNC~" would attempt to run MSGBOX.EXE from A:\,
because the "..\" has the effect of moving up one folder level, in this
case from A:\YNCdir\ to A:\.
2. You could keep separate text files with customized MSGBOX.TXT content
in each, and then copy each text file to a single copy of MSGBOX.TXT
whenever needed. For example:
@echo off
copy yesno.txt msgbox.txt
msgbox ~YN~
if errorlevel 2 goto :no
if errorlevel 1 goto :yes
copy exitcont.txt msgbox.txt
msgbox ~EC~
if errorlevel 2 goto :continue
if errorlevel 1 goto :exit
The example above copies the content of YESNO.TXT and EXITCONT.TXT into
a single copy of MSGBOX.TXT, each at the appropriate time. The example
assumes that the labels called (i.e. :no, :yes, :continue, and :exit)
exist elsewhere in the batch file.
The example above assumes that MSGBOX.EXE resides either in a folder
found in the PATH environment variable, or in the current directory.
License
~~~~~~~
See the FWLIC.TXT file included with this package.
Copyright
~~~~~~~~~
Copyright (c) 2004-2005, TeraByte, Inc. All Rights Reserved.