home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
batch
/
popup1_3.arj
/
POPUP.DOC
< prev
next >
Wrap
Text File
|
1991-01-10
|
15KB
|
404 lines
POPUP.EXE Batch File Menuing Utility. Copyright Geoff Lane 1990
1, System Requirements:
~~~~~~~~~~~~~~~~~~~
1. IBM PC/XT or PC/AT or compatible with CGA or MDA display.
2. Single or twin floppy disks with or without hard disk.
3. The ANSI.SYS screen control driver must be installed.
(to install ANSI.SYS place the file "ANSI.SYS" in the root
directory of your start-up disk and ensure that your
"CONFIG.SYS" file contains the line "DEVICE=ANSI.SYS")
2, Features:
~~~~~~~~
1. POPUP.EXE is designed as a DOS external command for the
provision of menu systems from the batch language.
2. The menus feature light bar and first character selection
3. Menus may be nested as deeply as required and each menu
may contain up to 20 selections.
3, File List
~~~~~~~~~
You should have found the following files in the archive POPUP1-3.ZIP
1. POPUP.EXE The popup program
2. CURSORTO.EXE An utility to place the cursor at any point on
the screen and to display a message if required
3. POPUP.DOC This documentation file
4. DEMO.BAT A batch file to demonstrate the use of POPUP.EXE
5. DEMO.POP A .POP configuration file for the main menu called
by DEMO.BAT.
4, Usage:
~~~~~
POPUP.EXE is called from within a batch file either with all
the configuration information contained in the command line
entry or by passing the name of a configuration file to the
POPUP on the command line.
1. Calling with Configuration Data on the Command Line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
POPUP is called in this mode by :
POPUP Row Column HEADING Option_1 [Option_2 [Option...]]
where Row and Column represent the location of the top,
left-hand corner of the menu box.
1. NOTE Row 0 , Column 0 is the top left-hand corner of the
screen.
HEADING represents the heading of your menu.
Option_1 .. Option... are the choices available to the user.
Note that spaces are used as delimeters in the command line
producing the menu. If you wish to include spaces in the
heading or any of the choices then the underscore should be
used. POPUP.EXE converts all underscores to spaces so that
"MAIN_MENU" would be converted to "MAIN MENU" by POPUP.EXE.
So if you wished to call up a menu with HEADING = MAIN MENU,
positioned at Row 5, Column 20 and with choices :
Wordprocessing, Spreadsheets and Databases then the command
line producing this would be:
POPUP 5 25 MAIN_MENU Wordprocessing Spreadsheets Databases
2. Limitations:
~~~~~~~~~~~
a. DOS only allows 127 characters in a command line so the
total length of your command line to call POPUP.EXE may
not exceed 127 characters. If you subtract the "POPUP Row
Column" part of the command line you will see that this
only allows 115 to 117 characters for your heading and
option list.
b. Because allowing you to specify the background and
foreground colour would have taken a sizable chunk out of
the remaining 115 to 117 characters available I have
restricted the menu display to white on black. These
colours will also display properly on a mono display.
c. POPUP.EXE produces the menu by sending ANSI control codes
to the screen. This means that the ANSI.SYS driver must
be installed. If it is not then the menu will display as
a heep of garbage but POPUP will still recognise your
keyboard input!
2. Calling with Configuration Data in a File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. You have the option of specifying a data file (ext .POP) to
configure the menu generated by POPUP.
You just have to specify the filename (minus the extension)
as the argument on the command line.
2. SYNTAX
~~~~~~
POPUP <filename>
so to call POPUP to display the menu detailed in EXAMPLE.POP
you would place the line:
POPUP EXAMPLE
In your batch file.
3. FORMAT FOR .POP FILE
~~~~~~~~~~~~~~~~~~~~
The format for .POP files is shown below. The file "DEMO.POP"
is included and may be studied as an example.
FORMAT
~~~~~~
Row {the row number of the top left corner}
Column {the column number of the top left corner}
Foreground Colour
Background Colour
Menu Heading
Option 1
Option 2
"
"
Option n {where n can be up to 20}
a. NOTE:
Leading and trailing spaces in the fields
{Row,Column,Foreground Colour,Background Colour} will
result in POPUP throwing a wobbly and telling you that
you have an input error.
Leading and trailing spaces in the Menu Heading and
Option fields are permitted and these fields may be up to
64 characters long. If you give a line with greater than
64 characters then POPUP will truncate them to 64 chars.
The colours may be any combination from the set
{black,blue,red,green,yellow,magenta,cyan,white} and
upper, lower or mixed cases are permitted.
5, Constructing Batch Files to use POPUP.EXE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Below is the listing for DEMO.BAT which was written to use
POPUP.EXE. This file was written to demonstrate the nesting
of menus and to give you something of a reference to model
your menus on.
Study the listing of DEMO.BAT to see how it has been used.
Note that braces "{" and "}" have been used to enclose
comments and that POPUP converts all underscores to spaces.
NOTE That the Main Menu has been called using the
configuration file method of callimg and that all the
submenus have been called with all the data on the command
line.
2. Listing for DEMO.BAT
~~~~~~~~~~~~~~~~~~~~
@echo off { turn off screen echo }
: start { label "start"}
cls { clear the screen }
popup demo { call POPUP.EXE with configuration }
{ data in file DEMO.POP }
if errorlevel 255 goto exit { if ESC pressed goto label "exit" }
if errorlevel 5 goto exit { if option 5 taken goto "exit" }
if errorlevel 4 goto 4 { if option 4 taken goto label "4" }
if errorlevel 3 goto 3 { if option 3 taken goto "3" }
if errorlevel 2 goto 2 { if option 2 taken goto "2" }
if errorlevel 1 goto 1 { if option 1 taken goto "1" }
: 1 {label "1" }
popup 7 15 WORD_PROCESSING Scrunge_Write Goof_Edit Zork_Word MyText
Main_Menu
{ call POPUP.EXE with configuration }
{ data on command line }
if errorlevel 255 goto start
if errorlevel 5 goto start { goto label as indicated by }
if errorlevel 4 goto mytext { DOS Errorlevel returned by }
if errorlevel 3 goto zork { POPUP.EXE }
if errorlevel 2 goto goof
if errorlevel 1 goto scrunge
: scrunge
cursorto 23 5 ***** Scrunge Write now running ! *****
goto 1 { call CURSORTO.EXE to display }
{ a message on the screen }
{ NOTE : any DOS application }
{ could have been called here }
: goof
cursorto 23 5 ******* Goof Edit now running ! *******
goto 1
: zork
cursorto 23 5 ******* Zork Word now running ! *******
goto 1
: mytext
cursorto 23 5 ******** MyText now running ! *********
goto 1
: 2
popup 8 30 DATABASES ScrungeBase File_Card_XI WhereIsIt Main_Menu
if errorlevel 255 goto start
if errorlevel 4 goto start
if errorlevel 3 goto whereisit
if errorlevel 2 goto filecard
if errorlevel 1 goto scrungeb
: scrungeb
cursorto 23 15 ******** Scrunge Base now running ! ********
goto 2
: filecard
cursorto 23 15 ******** File Card XI now running ! ********
goto 2
: whereisit
cursorto 23 15 ********* WhereIsIt now running ! **********
goto 2
: 3
popup 3 12 SPREADSHEETS GripeCalc Sheet_7_6_5 Main_Menu
if errorlevel 255 goto start
if errorlevel 3 goto start
if errorlevel 2 goto 765
if errorlevel 1 goto Gripe
: Gripe
cursorto 23 25 ******* GripeCalc now running *******
goto 3
: 765
cursorto 23 25 ****** Sheet 7 6 5 now running ******
goto 3
: 4
popup 10 20 GRAPHICS Draw_It Scrunge_Draw Paint_Bucket Main_Menu
if errorlevel 255 goto start
if errorlevel 4 goto start
if errorlevel 3 goto bucket
if errorlevel 2 goto scrunged
if errorlevel 1 goto drawit
: drawit
cursorto 23 35 ******** Draw It now running ! ********
goto 4
: scrunged
cursorto 23 35 ****** Scrunge Draw now running !******
goto 4
: bucket
cursorto 23 35 ****** Paint Bucket now running !******
goto 4
: exit
exit
3. Hints for using POPUP.EXE
~~~~~~~~~~~~~~~~~~~~~~~~~
1. If you have a single (or twin) floppy machine and have a RAM
disk installed then you will find the batch file and
POPUP.EXE will execute quicker if you copy your menu batch
file and POPUP.EXE to the RAM disk and run the batch file
from there.
2. Note that POPUP returns a DOS errorlevel to indicate which
option has been chosen. The errorlevel corresponds to the
position of the choice in the command line list of options,
so choosing the first option returns an errorlevel of 1, the
second an errorlevel of 2 and so on.
3. Note that "ESC" is allways an allowable option and will
return an errorlevel of 255. This is useful because can
write your batch file in such a way that successive presses
of the ESC key will take the user back to the main menu. You
may write your batch file so that the user will be returned
to the main menu when the ESC key is pressed at any menu or
you may write your batch file so that pressing the ESC key
will bring up any menu (including the current one).
4. Note that "if errorlevel x" really means "if the DOS
errorlevel is greater than or equal to x" so if the DOS
errorlevel is set to 5 then "errorlevel=x" is true for
x=1,x=2,x=3,x=4 and x=5. This means that the list of "if
errorlevel"'s in the batch file must be in decending order.
6, CURSORTO.EXE
~~~~~~~~~~~~
CURSORTO.EXE was written as a "quick hack" to neaten up the screen
display from DEMO.BAT and to provide a DOS program to call from
DEMO.BAT.
You are, of course, more than welcome to use it if you find it usefull.
The usage for CURSORTO.EXE is :=
CURSORTO <row> <column> [<print string>]
Where <row> is a number representing the row and <column> is a number
representing the column that you wish to position the cursor on,
<print string> is the message (if any) you wish displayed at the new
cursor position.
Please note that CURSORTO uses ANSI screen codes and, therefore, cannot
be used unless ANSI.SYS is installed.
7, IMPORTANT NOTICE
~~~~~~~~~~~~~~~~
1. You may use POPUP.EXE on any number of machines and may pass
copies on to friends and associates providing that no charge
is made for this and that copies of this documentation file,
CURSORTO.EXE, DEMO.POP and DEMO.BAT are passed together with
the copy of POPUP.EXE.
2. POPUP.EXE and the accompanying files are not guaranteed
suitable for any purpose and are not guaranteed to be error
free. The author accepts no liability whatsoever for any
damage to machine(s) or data caused by the use of POPUP.EXE
or any of the accompanying files.
8, REVISION HISTORY
~~~~~~~~~~~~~~~~
1. Version 0.0 May 1990
Written as a small utility for myself and a couple of
friends.
2. Version 1.0 September 1990
First character selection added. First publication.
3. Version 1.1 September 1990
Bug fixed allowing the "Input Error" message to be displayed
for all possible errors of usage (That I'm aware of,
anyway!).
4. Version 1.2 October 1990
Bug fixes If more that 10 options were entered then an error
message would be generated. POPUP now allows up to 20
selections (as promised in the instructions!) and now places
up to the first 20 choices in the menu. (The remainder are
lost).
5. Version 1.3 December 1990
Ability to read menu configuration data from .POP file added
Colours supported via .POP file.
9, Contacting the Author
~~~~~~~~~~~~~~~~~~~~~
If you wish to contact me about POPUP then I regularly use
the following UK BBSs and you are most welcome to leave a
message to me (Geoff Lane) there.
PHACS BBS
Plymouth (0752) 361291 N-8-1
FidoNet 2:255/28.0
TRANSWORLD BBS
Bristol (0272) 248447 / 248477 N-8-1