home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
BBS
/
CDROMDOC.ZIP
/
CDROM.DOC
next >
Wrap
Text File
|
1994-10-04
|
32KB
|
939 lines
original version 20 Aug 94
reversion <G> 4 Oct 94
changes: typos and grammar <sigh>
put in advice about very large files
CDROM by Dan Creagan
internet: dan.creagan@laka.com
BBS: 316-788-9392
Thus starts the documentation from hell:
READ THIS FILE. I have not provided a working program. I have
only described how to do it and included some source to get you
going. This is a 'do-it-yourself' CDROM door! (once you do one,
you will be unlikely to go back to your old program... you will
be very proud of your new creation!). I have tried to explain
everything at least twice (different words) so you have a chance
to track it all.
If you want to see the following door/code at work (just to prove
it does work before you go any further) .. call my BBS at 316-788-9392.
This is not a gimmick to get new callers .. if you trust me that
the following works then press on. If not, give the board a call
and check it out in operation ( although I do like new callers .. I'm
really a very friendly sysop <G>). I have made a special security level
that will give you one week's access without needing to call back.
( I think you have to answer about 6 questions .. 3 of them are y/n )
Unless you have prepared your directories in advance ( as with
any CDROM door tool ), you will not be successful. Each CD is different.
You will be expected to deal with these differences by changing
the program you make for each CD. (not hard .. after the first one
is made, it only takes an hour or so to modify it so it will work on
another CD .. easier than most CD Doors). A list of improvements will
be a seperate config file for the door so you don't have to recompile
each time. (WAAaaay down the road .. in fact, you should do this
since I probably won't EVER get to it).
It isn't hard, but you will have to understand the process
so you can make any changes... so study the following .. get a feel
for it.. and code up your own door..
This file has source code but it has been hacked up a bit for
instructional purposes.. it is reasonably close to what I am using,
but I won't make any guarantees about typos. I have implemented a
better search algorithm on my operational door, but the one I show here
is easier to explain (You start at the top and read lines until you
find the file... it's called 'the brute force' method <G>)
Assumptions you should *NOT* make about me:
I am a programmer
I have spent many hours on this document
My code is bug free
My code is structured or at least pretty
My code is efficient (ha!)
Assumptions you *should* make:
You can do a better job than I have if you just read this
file and get started.
My code works for me and has (or is) working on my BBS.
This document and all supporting programs are free.
You should read EVERY line of the source code and make changes
as necessary for your situation.
The examples herein are made with good intentions (I want to
share what I have in the hopes others will contribute also)
There is an element of Artificial Intelligence associated
with the program... if you use it and/or make it better the
program figures it out and will lock up on you until you
share your experience/code with others.
Opening Exposition:
The 'shareware author wannabes' are flooding the market. With
WcCode, most utilities that folks are asking unreasonable prices
for are at your fingertips. Couple this with the announce-
ment by MSI that WcCode apps are not guaranteed upward or backward
compatible for any release.. This means you should ALWAYS have the
source code for your WcCode apps. If you want a new door .. build
it yourself!
The following explains one of the doors that I am working on .. it is
not complete .. but it is very functional and has transferred many
megs of data to my users. It is but one example of a useful utility
that you can program if you want to spend a few hours learning WcCode
and then spend a small amount of time *thinking* before you settle
in to coding your program (awfully condescending ain't I?).
Have you wanted to program your own CDROM doors and been hesitant to
start the process? Have you got a CDROM door now and getting fed up
with the poor support or expensive updates? Well... Why don't you
use WcCode and make your own? It's relatively simple (takes a couple
of evenings of programming) and you are then on your way. In the
following paragraphs, I will explain my way of looking at CDROMs and
how I implemented a door to read them. You may choose to do the job
differently for your own BBS, but if you do, let me know what you did.
Let's share some information here!
Checklist (All topics are covered in more detail later)
1. Make a directory for your CDROM door to reside in.
2. Copy all the PC Board directories from your CD ROM into the directory
you just made. Strip off any header information from the PC Board
files.
3. Make an allfiles.txt file (all file descriptions in one blob) by
getting it off the CD or by stacking a copy of all the PC Board
directories together.
4. Make an alldirs.txt file that has all the pathnames to all the files
and the filenames. A typical line would be:
e:\disc1\windows\zip4win.zip
This may be on the CD... if not, then you must make it. (a Qbasic
program to do it is shown below). Note that the drive letter is
appended to the front of each line. This should be the drive
letter of YOUR CDROM.
5. Put the keyword/phrase search tool in the directory (included in this
package)
6. Make a work directory (c:\wildcat\wcwork\temp)
7. Put the 'search.bat' file .. in your Wildcat! directory. (included in
this package)
8. Put all the menus and '.BBS' files in the Wildcat directory (all
included in this package)
9. Compile a MODIFIED copy of the WcCode that is on here.
10. Make a WcCode test hook from your main menu so you can try the code.
11. Debug it.
12. Make a menu item for your users.
13. Sit back, have a brew, and pat yourself on the back.
OK... Now for the LONG Explanation
*******************************************
STEP ONE 'look for the keys to the CDROM':
*******************************************
Most CDROM doors have three capabilities. Keyword search, Directory Browse
and File Download. We will arrange the CD directories so we can do these
three things reasonably efficiently... sort of <G>.
Since all a CDROM door is, is a database management tool, then we should
look for the keys to the database. The CDROM makers usually provide
several different styles, but I have found that the PC Board listings
are the easiest to manipulate and there is often a PC Board main menu
that you can convert to your own main menu.
Look at the CD you want to bring on line. The following code assumes
that the CD has PC Board file descriptions. PC Board file descriptions
are easy to spot. They all begin with DIR and end with a one or two
digit number. Sometimes, just to make programming hard, CDROM makers
make ALL the PC Board file descriptions 4 or 5 digits long. Like thus:
directory 1 : instructions is in DIR1 or DIR01
directory 99: zmodem is in DIR99
If your CD DOESN'T have PC Board file listings, then you will have to
make them from Wildcat files.bbs lists (or modify my code to do it your
way).
If your CD doesn't have PC Board file listings, and you choose to make
some, then I suggest you just use the files.bbs list that should be in
each directory. You must rename each one to the appropriate DIRxx.
Keep track of the order you assign the directories so you can make a
main menu and a path search tool (see below for these).
CAUTION: Some directory listings will have 5 or 6 extra lines at the
top that have header information... some directory listings DON'T. You
should strip all these extra lines off so that the only thing in the files
are file descriptions.
**************************************************************************
STEP TWO 'arrange the keys so they are useful for your program (3 parts)':
**************************************************************************
Make a directory where all this stuff is going to reside. You will need
about a meg or so of space for each CD you do. Copy the PC Board dir files
(DIR1 through DIRxx) into a subdirectory called DIRS. This is a generic
approach and in my example, you will only need this one directory. There
are cases (which I will explain after the example is done) where you may
want to add more directories for clarity reasons.
root
|
CDROM Directory
|
----------------------------------------------
|
DIRS
Most CDROM doors have three capabilities. Keyword search, Directory Browse
and File Download. We will arrange the CD directories so we can do these
three things.
First: Keyword search. The file descriptions (usually available in the
allfiles.txt of the CD .. if not available, then just stack the DIRxx on
top of one another to make one big file) can be single or multiple line.
Your search tool must find a key word provided by the user in any line
and then back up and print the whole description down to the next file
description. If you only have single line descriptions, then a search
tool (like GREP) would be sufficient. However, I immediately ran into
the worse case when I started my program (the files descriptions were
sometimes 25 lines long). So I wrote a C program that will search the
file called 'ALLFILES.TXT' for keywords and write out all descriptions
to the screen. This program can be redirected to a data file for later
viewing by the user. The C code to do the job follows (I have included
the compiled source in this package so if you don't have a C compiler
you aren't screwed).
First program: Grep.exe (sorry Unix geeks .. your Grep sucks for this
job .. so I wrote my own):
This program will be called by a shell from your WcCode program. It
expects a keyword or phrase as a command line parameter and it outputs
all file descriptions that have the keyword or phrase to the screen.
In use, the output is redirected to a data file. You can test it with
out calling it from WcCode. Just have an allfiles.txt list in the
current directory, invoke the program with: grep <search string>. It
ignores case.
#include <stdio.h>
#include <string.h>
char buffer[40][120]; /* 120 is a bit fat .... guess I was paranoid when I made this <G> */
char dummy[120]; /* 80 would probably be fine (but ya never know) */
char buffercount, buffercount2,tempcounter, tempcounter2;
main(int argc, char *argv[])
{
FILE *fp;
if (argc <= 1)
{
printf("\nError... you must supply a command line argument.");
printf("\nThis file reads 'ALLFILES.TXT' and searches for");
printf("\nall the occurances of the string you input on the CL.");
printf("\nIt is built to display all lines of a multiline file");
printf("\ndescription.");
return(1);
}
strupr(argv[1]); /* convert keyword to upper case */
buffercount=0; /* start counting number of lines read in */
fp=fopen("allfiles.txt","r");
if(!fp)
{
printf("\nError opening allfiles.txt.");
return(1);
}
while(fgets(buffer[buffercount], 119, fp) != NULL) /* read through the whole file */
{
buffercount++;
if(buffercount>39) /* if a single file description is this long, there was a mistake */
{
printf("\n Exceeded array limits buffercount = %d",buffercount);
return(1);
}
if ((strstr(buffer[buffercount-1],"|")==NULL) && (buffercount!=1))
{ /* a bar '|' is a continuance line for file descriptions (seems
to be common for all file descriptions) .. if there is no
bar and the first line was already read in, then we have a new
description so we can check our buffer[] for keywords,
print out the buffer if it has key words, and then reset
the buffer and go back for more descriptions to look at */
buffercount2=buffercount;
for (tempcounter=0;tempcounter<(buffercount2-1);tempcounter++)
{
strcpy(dummy,buffer[tempcounter]);
strupr(dummy); /* this is awkward. What we are doing is setting
the buffer to uppercase for the search, but we
are not disturbing the original data. That way
it looks prettier when we show the output to
the user */
if (strstr(dummy,argv[1]))
{
for(tempcounter2=0;tempcounter2<(buffercount2-1);tempcounter2++)
printf("%s",buffer[tempcounter2]);
strcpy(buffer[0],buffer[buffercount2-1]); /* after flushing, we put the last line read
into the lowest postion in the buffer and
start over again. */
buffercount2=0;
} /*end if*/
} /*end for*/
strcpy(buffer[0],buffer[buffercount-1]); /* see the above comment */
buffercount=1;
} /*end if*/
} /*end while*/
return(0);
}
The above is why C is such a difficult language. Even documented it is hard
to understand what the hell is going on.
For use on the program I describe here, the output is redirected to a file
called 'data.dat' in the CDROM directory on your hard disk. It is then
opened by the WcCode program and displayed to the user.
grep mykeywordstring > data.dat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
There. You've completed one of the hard parts. (there are a couple more)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Second: Directory Viewing/Browsing. Most users like to Browse directories of
data to see if there are any kewl programs they can grab. (I know I
do). A CDROM door should let you do this. In the easiest of worlds,
the number of directories will not be huge and you can get all names on
one screen (the big exception to this is SIMTEL which has 122 directories
on one of its CDs). For the example, we will use a CD that has a
reasonable number of directories -- So Much Shareware 3 (25 dirs). If you use
the PC Board menu (it comes with most CDROMs) then you have a ready made tool
for the user to select the directory they want to browse. SMS 3 looks like
this after I cleaned up the PC Board menu that came on the disk:
@0E@@CLS@@0E@ @08@█@07@███████████████████████████████████████████████████████████████████████@0E@
@0E@ @08@█@1E@ @9A@ON LINE@1E@ So Much Shareware 3 @07@█
@0E@ @08@█@1E@ @07@█@0E@
@0E@ @08@█@1E@ 1 Games & Entertainment 14 Pascal Programming @07@█@0E@
@0E@ @08@█@1E@ 2 Educational & Learning 15 General Programming/Utils @07@█@0E@
@0E@ @08@█@1E@ 3 SoundBlaster, Music, Demos 16 Printing, Laser, Fonts @07@█@0E@
@0E@ @08@█@1E@ 4 MIDI Music & Utilities 17 Windows Printing/TrueType @07@█@0E@
@0E@ @08@█@1E@ 5 Graphics, Drawing, Animation 18 Word Processing / Editors @07@█@0E@
@0E@ @08@█@1E@ 6 Clipart & Desktop Publishing 19 Networking Utilities @07@█@0E@
@0E@ @08@█@1E@ 7 Home Finance And Budget 20 Desktop Aids & Utilities @07@█@0E@
@0E@ @08@█@1E@ 8 Financial And Business 21 General Utilities @07@█@0E@
@0E@ @08@█@1E@ 9 General Interest 22 Windows Applications @07@█@0E@
@0E@ @08@█@1E@ 10 Hobby And Sports 23 Windows NT Applications @07@█@0E@
@0E@ @08@█@1E@ 11 DataBase And Information 24 OS/2 Applications / Utilites @07@█@0E@
@0E@ @08@█@1E@ 12 C & Assembler Programming 25 Communications /BBS programs @07@█@0E@
@0E@ @08@█@1E@ 13 Visual/QuickBasic Programming @07@█
@0E@ @08@█@1E@ @07@█
@0E@ @08@█@1E@ (D)ownload, (C)hoose Directory, (S)earch, (H)elp, (Q)uit @07@█
@0E@ @08@███████████████████████████████████████████████████████████████████████@07@█
As you can see, the user can (C)hoose a Directory for viewing. When the
user does that, they are prompted for a directory number and the number
is changed to a string, added to the word "DIR" and you have the filename
of the directory you want to browse. In WcCode, it would look like
this.
sub choosedir
' this sub uses a global variable called cdrompath which is the
' path to your CDROM door directory
dim dirnum as integer
dim path as string, temp as string
dirnum=0
print
print
'get a valid directory number .. this check changes with each CDROM you
'install (the number of directories is always different)
while ((dirnum<1) OR (dirnum>25))
locate 22,24
print" ";
locate 22,24
input"Enter Dir # (0=Quit) ";dirnum
if dirnum=0 then exit sub
wend
'
'convert the number to a string, trim it, and make it a PC Board
'directory listing filename
'
path=str(dirnum)
ltrim(path)
if len(path)=1 then path="0"+path
path="dirs\dir"+path
path=cdrompath+path
cls
'
'if it exists (and it should if you've done your homework) then open
'it and view it. MorePrompt is On. You could insert code here to
'stop or download after each screen is shown (a mod I have done to
'other versions of this door).
'
if exists(path) then
open path for input as 1
while not eof(1)
input #1,temp
print temp
wend
close
waitenter
else
print"path not found..."
waitenter
end if
end sub
Third: Downloading (yesss!!)
When the user presses 'D' at the menu prompt (see menu above), a screen
is offered for them to enter the filename to download. A few simple
checks are made to ensure it is a proper file, and then a search is made
for the filename. You must prepare the directory you have made with a
list of all the filenames and their paths to the CDROM that you have
mounted. NOTE: the drive letter of the CDROM should be tacked to the head
of each path/filename!! This is usually easy enough to do...just takes some
thought and a few lines of Quickbasic to make the file. Sometimes the
file is already available on the CDROM. (be sure to look for it before
you make it... saves time <G>). If it is there, then you must put the drive
letter of your CD on the front of each line! If you have a list of directory
paths that are in order (but no filenames associated with them), you can
simply make a Basic program that reads in a directory path, attaches it
to each filename in the allfiles list, and prints it to a file called
ALLDIRS.DAT.
Again:
You have a file (called dirs.txt) of all the directory paths that looks
like this:
\disc1\windows
\disc1\progming
\disc1\catjuglg
<etc>
This file is usually on CDROMs... but not always. If it isn't, then you
will have to make it if you use the system I'm about to describe.
If your DIRxx files are in the same order as the above listing (ie: DIR01
files are all in \disc1\windows) then the following program will work:
' This is a QBASIC! program
'
' expects DIRS.TXT and all the DIRX files for PCB BBS
' DIRS.TXT has all the pathnames to the directories in it
' makes one list of all files with pathname set before them
' with SMS3 the directory names are all 4 digits long
'
OPEN "alldirs.txt" FOR OUTPUT AS 2
OPEN "dirs.txt" FOR INPUT AS 3
drive$ = "E:" :' drive that your CDROM is on
FOR x = 1 TO 25
'create the logical directory name that corresponds to the first
'path in the dirs.txt list.
'
temp$ = LTRIM$(STR$(x))
IF LEN(temp$) < 2 THEN temp$ = "0" + temp$
filename$ = "DIR" + temp$
'
'open it and read in all the filenames
'trim them, if they are valid, then make an
'entry in the alldirs.txt file of the filename with the
'path attached to it
'
OPEN filename$ FOR INPUT AS 1
LINE INPUT #3, path$
path$ = LTRIM$(path$)
path$ = RTRIM$(path$)
WHILE NOT EOF(1)
LINE INPUT #1, a$
a$ = LEFT$(a$, 12)
IF LEFT$(a$, 2) = " " THEN GOTO 20
a$ = LTRIM$(a$)
IF LEN(a$) < 4 THEN GOTO 20
PRINT #2, drive$ + path$ + "\" + a$
20
wend
close 1
NEXT x
This produces a file of all the filenames with the path to the CDROM
attached to their front. (if you use this as is, be sure to modify
it for your CDROM path). How do you like all them GOTOs Mr. Wirth? <G>
After you run it, check the alldirs.txt in a few places to make sure
you have aligned the right directories with the right filenames.
You have now prepared your work area and are ready to write the
WcCode to make your CDROM door.
****************************************************
STEP THREE: Have a beer .. relax... Make the WcCode
****************************************************
For the most part, the following code is reusable for all your CD
ROM installations. You will have to tweak the paths and some of the
other aspects of it, but it isn't long so the job isn't hard. It
takes me less time to set this up on a new CD than it takes to do
one for my 'mature' CDROM door that I paid hard cash for.
YOU MUST MAKE A TEMP DIRECTORY UNDER WCWORK on YOUR BBS for this
part to work!!! (or else change it so the program doesn't look there
for the files it grabs off the CDs)
You must do this:
cd \wildcat\wcwork
md temp
then you should be about ready to use this:
'
'This program has three main subroutines. They are choosedir, search,
'and downloadfile. All the rest of the subs are just support programs
'for these three main subs
'
cls
dim filename as string
dim answer as string
dim x as integer, y as integer
dim cdrompath as string
dim dummy2 as string
'YOU MUST SET THE FOLLOWING PATH ON YOUR MACHINE!!
'THE TRAILING BACKSLASH IS IMPORTANT WITH MY EXAMPLE!!!
'
cdrompath="u:\bbsfiles\sms3\"
declare sub downloadfile
sub audittrail
'This sub opens an audit trail (duh!) and appends whatever is in string
'DUMMY2 to the current user's name along with date and time. This is
'useful for debug, for tracking pests, for building a file to check
'for duplicate phone numbers (CBV only), and for just seeing what the
'door is doing for you. Since WcCode app selection is not recorded in
'the Activity log, this replaces that void .. plus a little. I realize
'there is an update utility in WcCode for the activity log. But I use this
'technique with the other half dozen or so utilities I have made and
'I use the same log file for all of them. I can make it as verbose as I
'like and kill it each day (I don't kill the activity logs daily ). The
'morning log file is almost as good reading as the message base!
rem if user.seclevel="SYSOP" then exit sub :'take off this rem after debug
Const DateMask = "mm/dd/yyyy"
Const TimeMask = "hh:mm:ss"
Dim today as date
dim timenow as time
currentdate(today)
currenttime(timenow)
open "wclog.dat" for append as 1
print #1,user.name ;dummy2;" at "formattime(timenow,timemask)" on "formatdate(today,datemask)
close
end sub
sub readfile
'
'generic screen reader ..
'
'reads in the menu screens and the prompt screens (download prompt,
'search prompt. It expects the global variable 'filename' to be
'initialized
'
dim temp as string
MorePrompt Off
open filename for input as 1
readfile1:
while not eof(1)
input #1, temp
print temp
wend
close
end sub
'**************************************
' Main Sub #1 'DOWNLOADFILE'
'**************************************
sub downloadfile
'
'sends file to user
'uses global variable "cdrompath" initialized to the cdrom path
'
dim temp as string
dim tempfilename as string
dim counter as integer
dim pdone as integer
dim dummy as string
down1:
filename="down.bbs":' included with this package.. it's just a small screen
readfile
temp=""
locate 12,26
input temp
cls
temp=ucase(temp)
if temp="Q" then exit sub
if len(temp)<5 then
locate 12,6
print"Invalid filename"
waitenter
goto down1
end if
locate 12,6
print"Standby ... searching for file (takes up to 1 minute)"
locate 13,6
print"Percent of filenames searched = 00";
counter=1
pdone = 0
open cdrompath+"dirs\alldirs.txt" for input as 1
while (not eof(1))
input #1, tempfilename
counter=counter+1
'
' while searching it is nice to update the screen so the user doesn't
' become antsy.
'
if counter=450 then
counter=1
pdone=pdone+10
locate 13,6
'
'the following is not really a percent .. just an estimate
'
print "Percent of filenames searched = ";pdone;
end if
'
'if file found, then verify it (this may not be necessary)
'
if instr(tempfilename,temp)>0 then
cls
locate 12,6
print tempfilename;
if inputYesNo(" <---- Is this your file (y/n) ? ") then
locate 13,6
close
'
' and send it ...
' locate 13,6
print"Standby .. fetching from CD .. don't hit any keys"
open"temp.bat" for output as 1
print #1,"copy "+tempfilename+" u:\wildcat\wcwork\temp"
close
'
' I have found some very large files don't like the shell to copy them
' from the CD. In that case, you will have to check to see how big
' the file is and tell the user to request it offline if it is over say
' 700k
'
open tempfilename for input as 1
if lof(1) > 700000 then
close
print"File too large for copy buffer. Please request from"
print"Sysop as an offline program."
dummy2=" file too big to transfer "+tempfilename+" "
audittrail
exit sub
end if
close
shell "temp.bat"
pushcommand "Y"
if sendfile("u:\wildcat\wcwork\temp\"+temp) then
print"success.."
waitenter
else
print"download failure...."
end if
exit sub
end if
end if
wend
close
end sub
'************************************
' Main sub #2 CHOOSEDIR
'************************************
sub choosedir
'
'Choose a directory to view. This is the basic routine. It should be
'modified so that when a screen is shown, the user can choose to
'quit , continue, or download (modify it after you get it working<G>)
'
'it uses the global variable cdrompath (which is the path to your
' cdrom info on your hard drive)
'
dim dirnum as integer
dim path as string, temp as string
dirnum=0
print
print
while ((dirnum<1) OR (dirnum>25))
locate 22,24
print" ";
locate 22,24
input"Enter Dir # (0=Quit) ";dirnum
if dirnum=0 then exit sub
wend
path=str(dirnum)
ltrim(path)
'
'expects the DIRXX files to all be 4 digits long. (DIR01, DIR02, DIR99)
'if they are variable (DIR1, DIR2, DIR99) then take off the next line
'
if len(path)=1 then path="0"+path
path="dirs\dir"+path
path=cdrompath+path
cls
'
'if you change this so you keep track of the screens (and not rely
'on the '(S)top (C)ontinue etc of the board) then enter
'MorePrompt Off .. so the board won't hack up your screen reads
'
if exists(path) then
open path for input as 1
while not eof(1)
input #1,temp
print temp
wend
close
waitenter
else
print"path not found..."
waitenter
end if
end sub
'**********************************************
' Main sub #3 SEARCH
'**********************************************
sub search
dim temp as string
dim templine as string,templine2 as string
dim x1 as integer
dim counter as integer
'
'uses global variable cdrompath
'
x1=1
search1:
filename="search.bbs" :'generic and simple menu screen that asks for
:'keyword for search (included in this package)
readfile
temp=""
locate 12,26
input temp
cls
temp=ucase(temp)
if temp="Q" then exit sub
if len(temp)<3 then
locate 12,6
print"Please search for strings longer than 2 letters"
waitenter
goto search1
end if
locate 13,6
print"Don't touch any keys! I'll be right back!"
shell "u:\wildcat\search.bat "+cdrompath+"dirs "+temp
cls
' the following prints out the hits that the GREP utility (which was
' implemented by the batch file above) has found. The reason it is
' so complicated is that it highlights the string when it finds it
' in any of the text lines.
open cdrompath+"dirs\data.dat" for input as 1
counter=1
while (not eof(1))
input #1,templine
templine2=templine
templine2=ucase(templine)
if(instr(templine2,temp)>1) then
print "@0F@"+left(templine,instr(templine2,temp)-1);
end if
if (instr(templine2,temp)<>0) then
print "@0E@"temp"@0F@";
print right(templine,len(templine)-((instr(templine2,temp)+len(temp)-1)))
else
print templine
end if
MorePrompt Off
counter=counter+1
if counter>19 then
counter=1
print
input"@0E@Press <Enter> for more, Q for quit, D for download ";templine
print
print
templine=ucase(templine)
if templine="Q" then
close
exit sub
end if
if templine="D" then
close
downloadfile
exit sub
end if
end if
wend
close
print"End of search"
waitenter
exit sub
end sub
'***********************************************
' OPENMAINMENU (where all the choices are made)
'***********************************************
sub OpenMainMenu
'
'here's where we open the main cdrom menu and ask for choices
'
dim choice as string
choice=""
while(choice<>"Q")
filename = "mainsms3.bbs" :'example included in this package
readfile
locate 22,24
print"Enter a choice (D,C,S,Q,H) ";
choice=""
while(choice="")
choice=inkey()
wend
choice=ucase(choice)
if choice="D" then downloadfile
if choice="C" then choosedir
if choice="S" then search
if choice="H" then
filename="CDHELP.BBS" :'example included in this package
readfile
waitenter
end if
wend
end sub
'
' ********************** BEGIN MAIN PROGRAM HERE *********************
'
'
'Opening screens and help
'
answer=""
dummy2=" entered CDROM5 door "
audittrail
OpenMainMenu
dummy2=" exited CDROM5 door "
audittrail
end
*********************************************************************
End of WcCode
*********************************************************************
Well, that was it. This will work if you read through it and
try to understand what's happening. Understand it before you
program it and you'll be ok.
Improvements:
The search routine for the filename to download is very slow. I have
since speeded it up by sorting the alldirs.txt file and using a better
algorithm (besides just a brute force one). It is a bit more complicated
than what I wanted to tackle with this first cut at showing how to
build the door. I'll send it over as an update if anyone wants to see
how.
A problem that I have often run into is that some CDs just have too
many directories. In cases like this, you will have to get creative
with your code and program modifications to the main menu. In one case,
I made 'combined DIR files' that had the menus from several directories
in one combined directory (like all APPSUTILS or WINDOWS). When the
user selected that directory, he was really looking at several at one
time. If you dial my board, you can see this in effect on two CDs. One,
the Night OWL 12 CD has the combined directories. The SIMTEL2 CD does
not. See which you would prefer to do.
All kinds of improvements to this are possible. Don't be alarmed at
the length of this. It is really easy to do once you start. If I were
you, I wouldn't even use this code... I'ld build my own... heck.. that's
why we all got WcCode in the first place. What independence this thing
gives us!