home *** CD-ROM | disk | FTP | other *** search
-
- Q.TTP
-
- by
-
- Chuck Grimsby
-
- Copyright 1989, 1990, 1991 by Chuck Grimsby
-
-
- In my "travels" via the modem around the country I've noticed
- quite a few BBSs are using some sort of program to give their
- users a quote or a thought for the day. I applaud those SysOps.
- From my point of view, we can ALL do with a brief bit of
- philosophy from time to time. Something to mull over during those
- (all too rare) quiet times when we ponder our existence.
-
- Scouring around for such a program to use myself, I noticed
- one thing about the programs that were available. They all read in
- some sort of file and printed out the text in either a sequential
- or random manner, but they never checked to see if that "thought"
- had been used before! One program even limited the user to only 10
- quotes!
-
- Thus was born the idea for my own program: Q.TTP.
-
- Q.TTP uses a "index" file to make sure the program does NOT
- repeat the same quotes over and over again. It's also "open ended"
- so that the user can have as few or as many "quotes" as they want.
-
- The unfortunate side of this is that the setup gets rather
- complex, so please read the following information carefully.
-
- There are a lot of files & Programs in the "Q family" so I
- STRONGLY suggest you make a folder on your drive for all this
- before you begin. You don't have to though.
-
- SET UP
-
- Before you can use the program you will of course need a
- collection of quotes or thoughts, or whatever for the program to
- use. There are a number of these things available already on most
- of the "major" BBSs. GEnie, CompUServe, BIX, ect no doubt have
- several in their various areas. You may have to go to their
- "religion" or "ethics" areas to find the stuff you need, but
- remember that Q.TTP won't care WHAT the text is. Humor and trivia
- are as valid as anything else, so feel free to look for that stuff
- as well!
-
- Since I'm a member there, I don't feel any shame in giving
- GEnie's Religion & Ethics RoundTable a plug! M 390 from any
- prompt.
-
- Once you've got the text you want to use, load it into your
- favorite Word Processor. You need to look at several things:
-
- 1) Where you want a quote to start, have a blank line. NO
- SPACES!!!!! (VERY IMPORTANT!!)
-
- 2) Where you want a quote to end, have a blank line. NO
- SPACES!!!!! ((VERY IMPORTANT!!)
-
- 3) DO NOT have two blank lines between the quotes!
-
- 4) If you want a blank line in the MIDDLE of a quote, make
- sure there is at LEAST one space on that line.
-
- 5) Make sure that BEFORE the first quote you want to use
- there is a blank line. (again NO SPACES on that line!!!)
-
- 6) Make sure that AFTER the last quote you want to use there
- is a a blank line. (and again NO SPACES on that line!!!)
-
- Now SAVE the text in ASCII format calling it "Q.ASC", and
- exit your Word Processor.
-
- Run the text you saved above through Q_VERT.PRG. Q_VERT will
- create a new file called "Q.TXT" which is the text file that Q.TTP
- will use. You may want to load this file into your Word Processor
- to double check your quotes. On all the blank lines in the Q.ASC
- file there will now be a single period (.). These periods mark the
- start and stop points for Q.TTP.
-
- WARNING:
- NOWHERE SHOULD YOU SEE THIS:
- .
- .
-
- IF YOU DO, YOU HAVE A EXTRA BLANK LINE IN YOUR FILE!!!!
- FIX YOUR Q.ASC FILE AND RE-RUN Q_VERT.PRG.
- (Enough caps, eh? I hope you get the message.)
-
- Now that Q.TXT is ready, run it through QIDXMAKE.PRG (why
- such a weird name? Answer: Q Index make.)
-
- QIDXMAKE.PRG will create the Q.IDX file for Q.TTP.
-
- another
- WARNING:
-
- ONCE Q.IDX IS CREATED YOU CAN NOT MODIFY Q.TXT WITHOUT RE-RUNNING
- QIDXMAKE.PRG!!!
-
- Besides Q.TXT and Q.IDX, Q.TTP also needs some information
- from you to tell it what to do with the "quote" it gets. So go
- back into your Word Processor and create a file called Q.INF.
-
- Q.INF is a simple 9 line ASCII file telling Q.TTP what to do.
-
- On the first line is the location of the quote file to use.
- Be sure to use a FULL GEM filename for it's location! (that's
- that <drive>:\<path>\<filename.ext> stuff like d:\quotes\q.txt.)
- The program will default to Q.TXT in the current folder if this
- information is not supplied, but PLEASE supply it just in case!
-
- On the second line put where you want the quote to go to. Use
- CON: if you want it to go to your screen, PRN: if you want it to
- go to your printer, or place on this line a GEM filename (see
- above) for where you want the quote to go.
-
- Line 3 is for what you want the program to do if there
- already is a file with the same name as in line one. Append or
- Replace are your only options here. (I don't need to tell you that
- Append will add to the existing file and Replace will erase the
- old file and create a new one, do I? Nah. Didn't think so.)
-
- Line 4 is for how you want the program to read the Q.TXT
- file. As mentioned previously, some people like things done in
- order, others like it as random as possible. Put the word RANDOM
- on line 4 if you want Q.TTP to randomly find a quote, or
- SEQUENTIAL if you want it to use the quotes in the order you have
- in your Q.TXT file. (Note: for those of you who have trouble
- spelling "sequential" (like me!) just use SEQ. RAN will also work
- work for RANDOM.)
-
- If you want some text to always appear before the "quote for
- the day", put that into a text file and put the name of that text
- file on line 5. Again, remember to use it's FULL GEM name
- (drive:\path\filename.ext).
-
- If you want the program to place some text after the quote,
- put the name of the file containing the text on line 6. (I'm not
- going to tell you to use the full GEM filename here. I'm sure
- you've already figured that out for yourself that you need to do
- that.)
-
- Line 7 is for the filename where you want Q.TTP to send it's
- warning that all the quotes have been used. FoReM ST SysOps who
- have the log to disk option on will want to put the location and
- name of their FOREM.LOG on this line. (There's more about this in
- the PROGRAM OPERATION section of this file.)
-
- Line 8 tells Q.TTP if you want the "statistics" printed out
- as a part of the "quote." Statistics are things like the "number"
- of the quote in the file, how many quotes there are in the file,
- the size in bytes of the quote, where the quote started at in the
- file, the number of times the program has run, the number of times
- the file has been re-cycled, what "mode" the program ran in to
- find the quote, and how many tries it took to find the quote it
- used. This information used to be printed to the screen, but some
- people wanted it in the output file so they could watch how Q.TTP
- was performing.
- If you want the "Statistics" printed out with the quote, Put
- the word "STATISTICS" on line 8. If you DON'T want the statistics
- printed out, put "NO STATISTICS" on line 8. Q.TTP defaults to "NO
- STATISTICS" if it can't understand this line.
-
- If you'd like a blank line to be printed out both before and
- after the quote, place the length you'd like that line to be on
- line 9 of the Q.INF file. If you place a 0 on line 9, the program
- won't put a blank line before and after the quote. Thus if you DO
- want a blank line, it must be at least 1 space long.
-
- Save this file as Q.INF in ASCII format from your Word
- Processor and that's it! Your set up is complete!
-
- Just one last thing. Remember that in order for Q.TTP to work
- properly, Q.IDX and Q.TXT _MUST_ be in the same directory! (It
- won't run right if you don't do this, so......)
-
- PROGRAM OPERATION
-
- When Q.TTP is run, the first thing it does is to read in the
- Q.INF file to find out what you want it to do and what files to
- use. It _assumes_ that Q.INF is in the same directory as the text
- file, so be forwarned about that! It then closes that file and
- opens up Q.IDX. The first thing it does there is to find out how
- many quotations there are in Q.TXT.
- If you've told it to run in sequential mode, it "searches"
- though the Q.IDX file until it finds a quote that hasn't been
- used.
- If you've told Q.TTP to run in random mode it generates a
- random number and checks the Q.IDX file to see if that quote has
- been used yet. If it has, it generates a new random number and
- tries again. If Q.TTP can't find a unused quote after 5 attempts,
- it will automatically switch to sequential mode and find the first
- unused quote and use that instead. (This was done to make sure
- that your computer wouldn't be "locked up" all day long looking
- for a unused quote.)
- After getting the starting point of the quote (in Q.TXT) and
- length information from Q.IDX, Q.TTP "marks" the quote as being
- used, and closes the file.
- If you've told the program that there's some text to "print"
- out before the quote, Q.TTP will read that in at this point.
- Q.TTP then opens up Q.TXT, jumps to the starting point of the
- quote, "reads" in the text it's supposed to and closes the file.
- Finally, Q.TTP opens up the file you've told it to "print"
- to, replacing or appending to it as you've told it to, "prints
- out" the "header" text (if there is any) and then the quote. If
- you've told Q.TTP to use a "trailer" file, that file is then
- opened, read in, and appended to the output file.
- The last thing Q.TTP does is to check to see if all the
- quotes in Q.TXT have been used. If they have, it "prints out" a
- warning to the operator that the quotes are "cycling" to the file
- named on line 7 of the Q.INF file. It then re-opens Q.IDX and goes
- through it marking each quote as not being used. Thus the next
- time Q.TTP is run, ALL the quotes are available!
-
- Some Final Notes
-
- This program is so simple that there is little "error
- trapping" in it. Not much is needed! Mostly, it just checks to
- make sure that the files it needs are where you've told it they
- are. If the files it needs are not available, the program will
- simply end. If it can't find the "header" or "trailer" text files,
- it just ignores them and goes on. So if you didn't get the
- "before" or "after" text you thought you had told Q.TTP to use
- check the Q.INF file to make sure the name and path you put there
- is the same as where and what the file actually is!
-
- I tried to make this as "free" as possible from limits as I
- could, but in reality there are actually 3 limits:
-
- 1) The "header" and "trailer" text files cannot be longer the
- 32,767 bytes.
- 2) No quote can be longer then 32,767 characters long.
- 3) You can only "cycle" through the Q.TXT file 256 times.
-
- Your computer WILL "crash" if you go over any of these limits!
-
- I also said above that the quotes in Q.TXT and Q.ASC have to
- be in ASCII format. Well, that's not _exactly_ true. You can also
- have VT-52 or VT-100 (or whatever) codes in there as well. The
- message I was trying to get across was NOT to do the "save" in
- your Word processor's format (i.e. Word Writer II or STWriter).
- Q.TTP won't do any translations, so if you save your file in that
- format and hope to use it all you're going to get is a mess!
-
- You also don't HAVE to run your ASCII file through Q_VERT if
- you want to put in all those periods yourself. Q_VERT was written
- to quickly convert a couple of files I already had but didn't have
- the periods in them. I thought you might be in a similar
- situation, so I added it to the procedure. The ONLY difference
- between Q.ASC & Q.TXT are those periods. (It also provides a VERY
- graphic way of seeing where you have "unwanted" blank lines, which
- Q.IDXMAKE will think are new quotes.)
-
- Once your Q.IDX is made, and you find you don't have to make
- any changes to the file, Q.ASC can be deleted. It isn't used
- anymore.
-
- TEXT SOURCES
-
- As mentioned previously, there are a number of good text
- files already available for conversion to use if you find yourself
- in need. Some suggestions to "search for" would be:
- (for humor) "PITHY" and "PITHY2" (someone ARC'd these
- together a while back into "PITHYTXT.ARC".)
- "MURPHY.ASC" is some of Mr. Murphy's "laws" (i.e. "There's no
- way to make something foolproof because fools are so ingenious.")
- Nearly the whole Bible is available in GEnie's Religion and
- Ethics RT and (no doubt) on many of the "Religious" BBSs that are
- around.
- "NOTEBOOK.TXT" is also floating around in BBS-Land. This
- file is also called "POWER_Q.TXT" from time to time. Don't make
- the same mistake I did and download both of them. They are the
- same file just renamed. (Thanks people. Sheesh!) It's a bunch of
- quotes for sales and "upwardly mobile" people.
- "10RIGHTS.ASC" is the Bill of Rights, which is also floating
- around in BBS-Land.
- "I_CHING.TXT" are some quotations from the Chinese book of
- changes: The I Ching.
- "LAZARUS.DOC" is some of Robert Heinlein's character Lazarus
- Long's "sayings".
-
- Q.TTP will also work just as well with trivia! Make a
- "header" file with the words "Did you know: " and then use ANY
- trivia book as a source.
-
- The Q*.* programs never look at the text in your Q.TXT or
- Q.ASC file (except for looking "blank" lines & column 1 periods in
- Q_VERT.PRG and QIDXMAKE.PRG respectively), so feel free to put
- whatever you want in Q.TXT!
-
- ADDED EXTRAS
-
- Along with the programs you need to set up and run Q.TTP, I'm
- also including two programs that are not needed, but are kind of
- helpful if you've got some problems.
-
- QIDXVIEW.PRG reads in your Q.IDX file and prints it's
- contents to your screen.
-
- QIDXVIE2.PRG uses both Q.IDX and Q.TXT to print both the
- status and the quote to your screen. So if you'd like to see the
- 15th qoute in your Q.TXT file, you can use QIDXVIE2 to see that
- quote.
-
- I'm also including 10 quotes that I've collected from various
- sources over quite a few years. Q.ASC is that file and it needs to
- be run through Q_VERT.PRG and QIDXMAKE.PRG to create the Q.IDX
- file before Q.TTP can use it. These 10 quotes are just to get you
- started. Obviously, 10 quotes aren't really enough to use. The
- REAL purpose of this is to get you used to the program, and to try
- it out to see if you like it enough to spend time looking for a
- bigger file, or typing something up yourself.
- By the way, if you do type something up yourself, I'd LOVE to
- see it! Just use any of the E-Mail sources below to send it to me.
- I won't pass it around unless you say it's OK.
-
- BUG REPORTS, ERRORS, & COMMENTS
-
- If you find a "bug" or get an error you can't account for, or
- if you just want to say "hi", feel free to contact me via any of
- the methods below:
-
-
- GEnie: C.GRIMSBY
- CompUServe: 73217,1363
- FIDO-NET: 1:282/47.1
-
- Enjoy!
-
- Chuck Grimsby
- January 7, 1990
- (Updated Feburary 27, 1991)
-
- Update Notice!
-
- Q.PRG, now Version 1.03, had two slight problems. It seems
- that if there wasn't a "proper" output line for the "re-cycle
- notice" (Q.INF line 5), the program would error out with a TOS
- error 33 (file or path not found.) This has now been fixed. If
- the line is left blank, or it's filled with spaces, Q.TTP will
- send it's notice to the screen. No alert box.
-
- So much for that. My Thanks to:
-
- Robert Groh
- Sysop of The Mind^s Eye BBS
- 614-231-3716 300/1200/2400 Baud 24 Hours/7 Days
- Visitor access through
- Name: Guest
- Password: Atari
-
- Free plug provided for his error report!
-
- Also fixed was a problem with the calculation of the number
- of runs. This didn't cause a problem with the program operation
- since the number is simply provided for the user's benefit, and as
- a "tool" for my use when I'm working on the program. It _was_
- adding to itself twice, but no longer. It now reports the correct
- number of times run.
-
- A new Q.ASC file is also being distributed with this archive.
- This one is a collection of quotes from our old friend Ben
- Franklin. There are 13 quotes in this file. Why 13? That's just
- how many I've collected so far. If someone can add to this....
-
- Update #2
-
- I've added additional error reporting to this version (1.04).
- To provide as few "problems" as possible to the SysOp, most of the
- reporting is done to the file listed on line 7 of the Q.INF file.
- (This is the same line that reports when all the quotes have been
- used.) With the improved error reporting, the only time the
- program _should_ require operator input is if the Q.INF file is
- *NOT* in the same directory as Q.PRG. Error reports sent to the
- Screen by leaving line 7 blank, filling it with spaces, or placing
- the word "CON:" on it *WILL* require a keypress however!
-
- The program will not stop if the "Header File" listed on line
- 5 of the Q.INF file. You _will_ get an Error Report from the
- Q.PRG saying that the file can't be found, but the program will
- continue on without it anyways.
-
- All reports are Time and Date stamped with the current system
- time and date and a line saying "Error report from Q.PRG" so
- SysOps can better "fix" the problem.
-
- When reporting errors, Q.PRG will automaticly append to the
- file listed on line 7 of Q.INF. If it doesn't exist, Q.INF will
- create it, so be sure to type the name correctly!
-
- UPDATE #3
-
- Q.PRG is now a TTP program! Once again, thanks to Robert
- Groh, SysOp of the Mind^s Eye BBS for the suggestion!
-
- If you read NOTHING else in this file, PLEASE read the
- following, as there are many changes from previous versions.
-
- The Q.INF file is now 9 lines long. Older versions of Q.INF
- were either 5 or 7 lines, but not only has the file "grown", the
- order has changed as well! PLEASE read the section on the Q.INF
- file to understand those changes.
-
- The main change in Q.TTP is that you may now use as many
- different text files, index files, and inf files as you wish.
- When you run Q.TTP enter the name of a INF file you wish to use on
- the command line. This file *DOES NOT* have to be named "Q.INF"
- nor does it have to be in the same directory or even on the same
- drive as Q.TTP. You don't have to have Q.TXT or Q.IDX in the same
- folder or drive either! They don't even have to be named Q.TXT or
- Q.IDX! The INF file you select will have the name and location of
- the text file in it (as line #1) and Q.TTP will figure out the
- name and location of the IDX file to use from that. (Q.TTP simply
- replaces the ".TXT" extention with ".IDX". Cheap trick, but it
- works!) Be warned, Q.TTP will expect to find the IDX file in the
- same directory as the TXT file!
-
- The ONLY restriction here is that the text file MUST, I
- repeat *MUST* have a extention of some form! The routine I use to
- get the name of the IDX file looks for the LAST "." in the text
- file name and replaces whatever is after that with "IDX". (That's
- the problem with "cheap tricks." You have to follow certain rules
- to make them work. <sigh> )
-
- If you run Q.TTP with no arguements on the command line,
- Q.TTP will look for Q.TXT, Q.IDX, and Q.INF in the same directory
- as the program is. (These are the "default" settings left in for
- those that don't care and want a program that's simple to
- run.) (Like me! <GRIN> )
-
- QIDXMAKE.PRG has also been fixed so that you can now "change"
- your text file and not lose any of the used/not used data or
- number of times run, number of times "cycled". When run,
- QIDXMAKE.PRG looks to see if there is a Q.IDX file already in the
- same folder as Q.TXT. If there is, it is renamed as Q_OLD.IDX and
- as the new IDX file is created the data is copied over. This way
- you can now edit out spelling errors, or increase the file without
- losing all the data on what quotes have been used. (Yes, you can
- now ADD to the text file!) My thanks go out to the SysOp of a
- private BBS who asked not to be named for the suggestion. (See, I
- didn't say who you were. You can now relax. <grin> )
-
- Once QIDXMAKE.PRG is done, you may remove Q_OLD.IDX if you
- want. QIDXMAKE.PRG won't do that automaticly in case you change
- your mind.
-
- UPDATE #4
-
- There was a problem in the way Q.TTP got the "quote" it was
- to use. Often, for no appearent reason, the program would grab
- the last carridge return or line feed from the line before the
- quote! Although I've not quite yet determined how/why this
- happens, I added in a routine to check for it and to eliminate it
- from the quote when it happens.
-
- Q.INF has been increased by 2 lines to add two more options
- for the user. See the part of this document about lines 8 and 9
- for more information on those changes. (Statistics and blank
- lines.)
-
-