home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / bbs / q / q_doc.asc next >
Encoding:
Text File  |  1991-04-20  |  21.2 KB  |  465 lines

  1.  
  2.                               Q.TTP
  3.  
  4.                                 by
  5.  
  6.                           Chuck Grimsby
  7.  
  8.            Copyright 1989, 1990, 1991 by Chuck Grimsby
  9.  
  10.  
  11.      In my "travels" via the modem around the country I've noticed 
  12. quite a few BBSs are using some sort of program to give their 
  13. users a quote or a thought for the day. I applaud those SysOps. 
  14. From my point of view, we can ALL do with a brief bit of 
  15. philosophy from time to time. Something to mull over during those 
  16. (all too rare) quiet times when we ponder our existence.
  17.  
  18.      Scouring around for such a program to use myself, I noticed 
  19. one thing about the programs that were available. They all read in 
  20. some sort of file and printed out the text in either a sequential 
  21. or random manner, but they never checked to see if that "thought" 
  22. had been used before! One program even limited the user to only 10 
  23. quotes!
  24.  
  25.      Thus was born the idea for my own program: Q.TTP.
  26.  
  27.      Q.TTP uses a "index" file to make sure the program does NOT 
  28. repeat the same quotes over and over again. It's also "open ended" 
  29. so that the user can have as few or as many "quotes" as they want.
  30.  
  31.      The unfortunate side of this is that the setup gets rather 
  32. complex, so please read the following information carefully.
  33.  
  34.      There are a lot of files & Programs in the "Q family" so I 
  35. STRONGLY suggest you make a folder on your drive for all this 
  36. before you begin. You don't have to though.
  37.  
  38.                               SET UP
  39.  
  40.      Before you can use the program you will of course need a 
  41. collection of quotes or thoughts, or whatever for the program to 
  42. use. There are a number of these things available already on most 
  43. of the "major" BBSs. GEnie, CompUServe, BIX, ect no doubt have 
  44. several in their various areas. You may have to go to their 
  45. "religion" or "ethics" areas to find the stuff you need, but 
  46. remember that Q.TTP won't care WHAT the text is. Humor and trivia 
  47. are as valid as anything else, so feel free to look for that stuff 
  48. as well!
  49.  
  50.      Since I'm a member there, I don't feel any shame in giving 
  51. GEnie's Religion & Ethics RoundTable a plug! M 390 from any 
  52. prompt.
  53.  
  54.      Once you've got the text you want to use, load it into your 
  55. favorite Word Processor. You need to look at several things:
  56.  
  57.      1) Where you want a quote to start, have a blank line. NO 
  58. SPACES!!!!! (VERY IMPORTANT!!)
  59.  
  60.      2) Where you want a quote to end, have a blank line. NO 
  61. SPACES!!!!! ((VERY IMPORTANT!!)
  62.  
  63.      3) DO NOT have two blank lines between the quotes!
  64.  
  65.      4) If you want a blank line in the MIDDLE of a quote, make 
  66. sure there is at LEAST one space on that line.
  67.  
  68.      5) Make sure that BEFORE the first quote you want to use 
  69. there is a blank line. (again NO SPACES on that line!!!)
  70.  
  71.      6) Make sure that AFTER the last quote you want to use there 
  72. is a a blank line. (and again NO SPACES on that line!!!)
  73.  
  74.      Now SAVE the text in ASCII format calling it "Q.ASC", and 
  75. exit your Word Processor.
  76.  
  77.      Run the text you saved above through Q_VERT.PRG. Q_VERT will 
  78. create a new file called "Q.TXT" which is the text file that Q.TTP 
  79. will use. You may want to load this file into your Word Processor 
  80. to double check your quotes. On all the blank lines in the Q.ASC 
  81. file there will now be a single period (.). These periods mark the 
  82. start and stop points for Q.TTP.
  83.  
  84.                              WARNING: 
  85.                    NOWHERE SHOULD YOU SEE THIS:
  86. .
  87. .
  88.  
  89. IF YOU DO, YOU HAVE A EXTRA BLANK LINE IN YOUR FILE!!!!
  90. FIX YOUR Q.ASC FILE AND RE-RUN Q_VERT.PRG.
  91. (Enough caps, eh? I hope you get the message.)
  92.  
  93.      Now that Q.TXT is ready, run it through QIDXMAKE.PRG (why 
  94. such a weird name? Answer: Q Index make.)
  95.  
  96. QIDXMAKE.PRG will create the Q.IDX file for Q.TTP.
  97.  
  98.                              another
  99.                              WARNING:
  100.  
  101. ONCE Q.IDX IS CREATED YOU CAN NOT MODIFY Q.TXT WITHOUT RE-RUNNING 
  102. QIDXMAKE.PRG!!!
  103.  
  104.      Besides Q.TXT and Q.IDX, Q.TTP also needs some information 
  105. from you to tell it what to do with the "quote" it gets. So go 
  106. back into your Word Processor and create a file called Q.INF.
  107.  
  108.      Q.INF is a simple 9 line ASCII file telling Q.TTP what to do.
  109.  
  110.      On the first line is the location of the quote file to use. 
  111. Be sure to use a FULL GEM filename for it's location!  (that's 
  112. that <drive>:\<path>\<filename.ext> stuff like d:\quotes\q.txt.) 
  113. The program will default to Q.TXT in the current folder if this 
  114. information is not supplied, but PLEASE supply it just in case!
  115.  
  116.      On the second line put where you want the quote to go to. Use 
  117. CON: if you want it to go to your screen, PRN: if you want it to 
  118. go to your printer, or place on this line a GEM filename (see 
  119. above) for where you want the quote to go.
  120.  
  121.      Line 3 is for what you want the program to do if there 
  122. already is a file with the same name as in line one. Append or 
  123. Replace are your only options here. (I don't need to tell you that 
  124. Append will add to the existing file and Replace will erase the 
  125. old file and create a new one, do I? Nah. Didn't think so.)
  126.  
  127.      Line 4 is for how you want the program to read the Q.TXT 
  128. file. As mentioned previously, some people like things done in 
  129. order, others like it as random as possible. Put the word RANDOM 
  130. on line 4 if you want Q.TTP to randomly find a quote, or 
  131. SEQUENTIAL if you want it to use the quotes in the order you have 
  132. in your Q.TXT file. (Note: for those of you who have trouble 
  133. spelling "sequential" (like me!) just use SEQ. RAN will also work 
  134. work for RANDOM.)
  135.  
  136.      If you want some text to always appear before the "quote for 
  137. the day", put that into a text file and put the name of that text 
  138. file on line 5. Again, remember to use it's FULL GEM name 
  139. (drive:\path\filename.ext).
  140.  
  141.      If you want the program to place some text after the quote, 
  142. put the name of the file containing the text on line 6. (I'm not 
  143. going to tell you to use the full GEM filename here.  I'm sure 
  144. you've already figured that out for yourself that you need to do 
  145. that.)
  146.  
  147.      Line 7 is for the filename where you want Q.TTP to send it's 
  148. warning that all the quotes have been used. FoReM ST SysOps who 
  149. have the log to disk option on will want to put the location and 
  150. name of their FOREM.LOG on this line. (There's more about this in 
  151. the PROGRAM OPERATION section of this file.)
  152.  
  153.      Line 8 tells Q.TTP if you want the "statistics" printed out 
  154. as a part of the "quote."  Statistics are things like the "number" 
  155. of the quote in the file, how many quotes there are in the file, 
  156. the size in bytes of the quote, where the quote started at in the 
  157. file, the number of times the program has run, the number of times 
  158. the file has been re-cycled, what "mode" the program ran in to 
  159. find the quote, and how many tries it took to find the quote it 
  160. used.  This information used to be printed to the screen, but some 
  161. people wanted it in the output file so they could watch how Q.TTP 
  162. was performing.
  163.      If you want the "Statistics" printed out with the quote, Put 
  164. the word "STATISTICS" on line 8.  If you DON'T want the statistics 
  165. printed out, put "NO STATISTICS" on line 8.  Q.TTP defaults to "NO 
  166. STATISTICS" if it can't understand this line.
  167.  
  168.      If you'd like a blank line to be printed out both before and 
  169. after the quote, place the length you'd like that line to be on 
  170. line 9 of the Q.INF file.  If you place a 0 on line 9, the program 
  171. won't put a blank line before and after the quote.  Thus if you DO 
  172. want a blank line, it must be at least 1 space long.
  173.  
  174.      Save this file as Q.INF in ASCII format from your Word 
  175. Processor and that's it! Your set up is complete!
  176.  
  177.      Just one last thing. Remember that in order for Q.TTP to work 
  178. properly, Q.IDX and Q.TXT _MUST_ be in the same directory! (It 
  179. won't run right if you don't do this, so......)
  180.  
  181.                         PROGRAM OPERATION
  182.  
  183.      When Q.TTP is run, the first thing it does is to read in the 
  184. Q.INF file to find out what you want it to do and what files to 
  185. use.  It _assumes_ that Q.INF is in the same directory as the text 
  186. file, so be forwarned about that!  It then closes that file and 
  187. opens up Q.IDX. The first thing it does there is to find out how 
  188. many quotations there are in Q.TXT.
  189.      If you've told it to run in sequential mode, it "searches" 
  190. though the Q.IDX file until it finds a quote that hasn't been 
  191. used.
  192.      If you've told Q.TTP to run in random mode it generates a 
  193. random number and checks the Q.IDX file to see if that quote has 
  194. been used yet. If it has, it generates a new random number and 
  195. tries again. If Q.TTP can't find a unused quote after 5 attempts, 
  196. it will automatically switch to sequential mode and find the first 
  197. unused quote and use that instead. (This was done to make sure 
  198. that your computer wouldn't be "locked up" all day long looking 
  199. for a unused quote.)
  200.      After getting the starting point of the quote (in Q.TXT) and 
  201. length information from Q.IDX, Q.TTP "marks" the quote as being 
  202. used, and closes the file.
  203.      If you've told the program that there's some text to "print" 
  204. out before the quote, Q.TTP will read that in at this point.
  205.      Q.TTP then opens up Q.TXT, jumps to the starting point of the 
  206. quote, "reads" in the text it's supposed to and closes the file.
  207.      Finally, Q.TTP opens up the file you've told it to "print" 
  208. to, replacing or appending to it as you've told it to, "prints 
  209. out" the "header" text (if there is any) and then the quote.  If 
  210. you've told Q.TTP to use a "trailer" file, that file is then 
  211. opened, read in, and appended to the output file.
  212.      The last thing Q.TTP does is to check to see if all the 
  213. quotes in Q.TXT have been used. If they have, it "prints out" a 
  214. warning to the operator that the quotes are "cycling" to the file 
  215. named on line 7 of the Q.INF file. It then re-opens Q.IDX and goes 
  216. through it marking each quote as not being used. Thus the next 
  217. time Q.TTP is run, ALL the quotes are available!
  218.  
  219.                          Some Final Notes
  220.  
  221.      This program is so simple that there is little "error 
  222. trapping" in it. Not much is needed! Mostly, it just checks to 
  223. make sure that the files it needs are where you've told it they 
  224. are. If the files it needs are not available, the program will 
  225. simply end. If it can't find the "header" or "trailer" text files, 
  226. it just ignores them and goes on. So if you didn't get the 
  227. "before" or "after" text you thought you had told Q.TTP to use 
  228. check the Q.INF file to make sure the name and path you put there 
  229. is the same as where and what the file actually is!
  230.  
  231.      I tried to make this as "free" as possible from limits as I 
  232. could, but in reality there are actually 3 limits:
  233.  
  234.      1) The "header" and "trailer" text files cannot be longer the    
  235.         32,767 bytes.
  236.      2) No quote can be longer then 32,767 characters long.
  237.      3) You can only "cycle" through the Q.TXT file 256 times.
  238.  
  239. Your computer WILL "crash" if you go over any of these limits!
  240.  
  241.      I also said above that the quotes in Q.TXT and Q.ASC have to 
  242. be in ASCII format. Well, that's not _exactly_ true. You can also 
  243. have VT-52 or VT-100 (or whatever) codes in there as well. The 
  244. message I was trying to get across was NOT to do the "save" in 
  245. your Word processor's format (i.e. Word Writer II or STWriter). 
  246. Q.TTP won't do any translations, so if you save your file in that 
  247. format and hope to use it all you're going to get is a mess!
  248.  
  249.      You also don't HAVE to run your ASCII file through Q_VERT if 
  250. you want to put in all those periods yourself. Q_VERT was written 
  251. to quickly convert a couple of files I already had but didn't have 
  252. the periods in them. I thought you might be in a similar 
  253. situation, so I added it to the procedure. The ONLY difference 
  254. between Q.ASC & Q.TXT are those periods. (It also provides a VERY 
  255. graphic way of seeing where you have "unwanted" blank lines, which 
  256. Q.IDXMAKE will think are new quotes.)
  257.  
  258.      Once your Q.IDX is made, and you find you don't have to make 
  259. any changes to the file, Q.ASC can be deleted. It isn't used 
  260. anymore.
  261.  
  262.                            TEXT SOURCES
  263.  
  264.      As mentioned previously, there are a number of good text 
  265. files already available for conversion to use if you find yourself 
  266. in need. Some suggestions to "search for" would be:
  267.      (for humor) "PITHY" and "PITHY2" (someone ARC'd these 
  268. together a while back into "PITHYTXT.ARC".)
  269.      "MURPHY.ASC" is some of Mr. Murphy's "laws" (i.e. "There's no 
  270. way to make something foolproof because fools are so ingenious.")
  271.      Nearly the whole Bible is available in GEnie's Religion and 
  272. Ethics RT and (no doubt) on many of the "Religious" BBSs that are 
  273. around.
  274.      "NOTEBOOK.TXT" is also floating around in BBS-Land.  This 
  275. file is also called "POWER_Q.TXT" from time to time.  Don't make 
  276. the same mistake I did and download both of them.  They are the 
  277. same file just renamed. (Thanks people.  Sheesh!)  It's a bunch of 
  278. quotes for sales and "upwardly mobile" people.
  279.      "10RIGHTS.ASC" is the Bill of Rights, which is also floating 
  280. around in BBS-Land.
  281.      "I_CHING.TXT" are some quotations from the Chinese book of 
  282. changes: The I Ching.
  283.      "LAZARUS.DOC" is some of Robert Heinlein's character Lazarus 
  284. Long's "sayings".
  285.  
  286.      Q.TTP will also work just as well with trivia! Make a 
  287. "header" file with the words "Did you know: " and then use ANY 
  288. trivia book as a source.
  289.  
  290.      The Q*.* programs never look at the text in your Q.TXT or 
  291. Q.ASC file (except for looking "blank" lines & column 1 periods in 
  292. Q_VERT.PRG and QIDXMAKE.PRG respectively), so feel free to put 
  293. whatever you want in Q.TXT!
  294.  
  295.                            ADDED EXTRAS
  296.  
  297.      Along with the programs you need to set up and run Q.TTP, I'm 
  298. also including two programs that are not needed, but are kind of 
  299. helpful if you've got some problems.
  300.  
  301.      QIDXVIEW.PRG reads in your Q.IDX file and prints it's 
  302. contents to your screen.
  303.  
  304.      QIDXVIE2.PRG uses both Q.IDX and Q.TXT to print both the 
  305. status and the quote to your screen. So if you'd like to see the 
  306. 15th qoute in your Q.TXT file, you can use QIDXVIE2 to see that 
  307. quote.
  308.  
  309.      I'm also including 10 quotes that I've collected from various 
  310. sources over quite a few years. Q.ASC is that file and it needs to 
  311. be run through Q_VERT.PRG and QIDXMAKE.PRG to create the Q.IDX 
  312. file before Q.TTP can use it. These 10 quotes are just to get you 
  313. started. Obviously, 10 quotes aren't really enough to use. The 
  314. REAL purpose of this is to get you used to the program, and to try 
  315. it out to see if you like it enough to spend time looking for a 
  316. bigger file, or typing something up yourself.
  317.      By the way, if you do type something up yourself, I'd LOVE to 
  318. see it! Just use any of the E-Mail sources below to send it to me. 
  319. I won't pass it around unless you say it's OK.
  320.  
  321.                  BUG REPORTS, ERRORS, & COMMENTS
  322.  
  323.      If you find a "bug" or get an error you can't account for, or 
  324. if you just want to say "hi", feel free to contact me via any of 
  325. the methods below:
  326.  
  327.  
  328. GEnie:      C.GRIMSBY
  329. CompUServe: 73217,1363
  330. FIDO-NET:  1:282/47.1
  331.  
  332.                               Enjoy!
  333.  
  334.                           Chuck Grimsby
  335.                          January 7, 1990
  336.                    (Updated Feburary 27, 1991)
  337.  
  338.                           Update Notice!
  339.  
  340.      Q.PRG, now Version 1.03, had two slight problems.  It seems 
  341. that if there wasn't a "proper" output line for the "re-cycle 
  342. notice" (Q.INF line 5), the program would error out with a TOS 
  343. error 33 (file or path not found.)  This has now been fixed.  If 
  344. the line is left blank, or it's filled with spaces, Q.TTP will 
  345. send it's notice to the screen.  No alert box.
  346.  
  347. So much for that.  My Thanks to:
  348.  
  349.                            Robert Groh
  350.                    Sysop of The Mind^s Eye BBS
  351.          614-231-3716 300/1200/2400 Baud 24 Hours/7 Days
  352.                       Visitor access through
  353.                            Name: Guest
  354.                          Password: Atari
  355.  
  356.              Free plug provided for his error report!
  357.  
  358.      Also fixed was a problem with the calculation of the number 
  359. of runs.  This didn't cause a problem with the program operation 
  360. since the number is simply provided for the user's benefit, and as 
  361. a "tool" for my use when I'm working on the program.  It _was_ 
  362. adding to itself twice, but no longer.  It now reports the correct 
  363. number of times run.
  364.  
  365.      A new Q.ASC file is also being distributed with this archive.  
  366. This one is a collection of quotes from our old friend Ben 
  367. Franklin.  There are 13 quotes in this file.  Why 13?  That's just 
  368. how many I've collected so far.  If someone can add to this....
  369.  
  370.                             Update #2
  371.  
  372.      I've added additional error reporting to this version (1.04).  
  373. To provide as few "problems" as possible to the SysOp, most of the 
  374. reporting is done to the file listed on line 7 of the Q.INF file.  
  375. (This is the same line that reports when all the quotes have been 
  376. used.)  With the improved error reporting, the only time the 
  377. program _should_ require operator input is if the Q.INF file is 
  378. *NOT* in the same directory as Q.PRG.  Error reports sent to the 
  379. Screen by leaving line 7 blank, filling it with spaces, or placing 
  380. the word "CON:" on it *WILL* require a keypress however!
  381.  
  382.      The program will not stop if the "Header File" listed on line 
  383. 5 of the Q.INF file.  You _will_ get an Error Report from the 
  384. Q.PRG saying that the file can't be found, but the program will 
  385. continue on without it anyways.
  386.  
  387.      All reports are Time and Date stamped with the current system 
  388. time and date and a line saying "Error report from Q.PRG" so 
  389. SysOps can better "fix" the problem.
  390.  
  391.      When reporting errors, Q.PRG will automaticly append to the 
  392. file listed on line 7 of Q.INF.  If it doesn't exist, Q.INF will 
  393. create it, so be sure to type the name correctly!
  394.  
  395.                             UPDATE #3
  396.  
  397.      Q.PRG is now a TTP program!  Once again, thanks to Robert 
  398. Groh, SysOp of the Mind^s Eye BBS for the suggestion!
  399.  
  400.      If you read NOTHING else in this file, PLEASE read the 
  401. following, as there are many changes from previous versions.
  402.  
  403.      The Q.INF file is now 9 lines long.  Older versions of Q.INF 
  404. were either 5 or 7 lines, but not only has the file "grown", the 
  405. order has changed as well!  PLEASE read the section on the Q.INF 
  406. file to understand those changes.
  407.  
  408.      The main change in Q.TTP is that you may now use as many 
  409. different text files, index files, and inf files as you wish.  
  410. When you run Q.TTP enter the name of a INF file you wish to use on 
  411. the command line.  This file *DOES NOT* have to be named "Q.INF" 
  412. nor does it have to be in the same directory or even on the same 
  413. drive as Q.TTP.  You don't have to have Q.TXT or Q.IDX in the same 
  414. folder or drive either!  They don't even have to be named Q.TXT or 
  415. Q.IDX!  The INF file you select will have the name and location of 
  416. the text file in it (as line #1) and Q.TTP will figure out the 
  417. name and location of the IDX file to use from that.  (Q.TTP simply 
  418. replaces the ".TXT" extention with ".IDX".  Cheap trick, but it 
  419. works!)  Be warned, Q.TTP will expect to find the IDX file in the 
  420. same directory as the TXT file!
  421.  
  422.      The ONLY restriction here is that the text file MUST, I 
  423. repeat *MUST* have a extention of some form!  The routine I use to 
  424. get the name of the IDX file looks for the LAST "." in the text 
  425. file name and replaces whatever is after that with "IDX".  (That's 
  426. the problem with "cheap tricks."  You have to follow certain rules 
  427. to make them work.  <sigh> )
  428.  
  429.      If you run Q.TTP with no arguements on the command line, 
  430. Q.TTP will look for Q.TXT, Q.IDX, and Q.INF in the same directory 
  431. as the program is.  (These are the "default" settings left in for 
  432. those that don't care and want a program that's simple to 
  433. run.) (Like me! <GRIN> )
  434.  
  435.      QIDXMAKE.PRG has also been fixed so that you can now "change" 
  436. your text file and not lose any of the used/not used data or 
  437. number of times run, number of times "cycled".  When run, 
  438. QIDXMAKE.PRG looks to see if there is a Q.IDX file already in the 
  439. same folder as Q.TXT.  If there is, it is renamed as Q_OLD.IDX and 
  440. as the new IDX file is created the data is copied over.  This way 
  441. you can now edit out spelling errors, or increase the file without 
  442. losing all the data on what quotes have been used.  (Yes, you can 
  443. now ADD to the text file!)  My thanks go out to the SysOp of a 
  444. private BBS who asked not to be named for the suggestion.  (See, I 
  445. didn't say who you were.  You can now relax.  <grin> )
  446.  
  447.      Once QIDXMAKE.PRG is done, you may remove Q_OLD.IDX if you 
  448. want.  QIDXMAKE.PRG won't do that automaticly in case you change 
  449. your mind.
  450.  
  451.                             UPDATE #4
  452.  
  453.      There was a problem in the way Q.TTP got the "quote" it was 
  454. to use.  Often, for no appearent reason, the program would grab 
  455. the last carridge return or line feed from the line before the 
  456. quote!  Although I've not quite yet determined how/why this 
  457. happens, I added in a routine to check for it and to eliminate it 
  458. from the quote when it happens.
  459.  
  460.      Q.INF has been increased by 2 lines to add two more options 
  461. for the user.  See the part of this document about lines 8 and 9 
  462. for more information on those changes. (Statistics and blank 
  463. lines.)
  464.  
  465.