home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / BF / BF186.ZIP / LPTX.DOC < prev    next >
Text File  |  1990-09-27  |  16KB  |  389 lines

  1.  
  2. LPTx : Line Printer Output Capture Routine
  3.  
  4. ------------------------------------------------------------------------
  5. Version 8.00/8.00a Beta
  6.  
  7. (C) Copyright 1990 by Mark C. DiVecchio, All Rights Reserved
  8.     Author : Mark C. DiVecchio
  9.  
  10. DISCLAMER : This program tries to perform a function which is not supported
  11. by DOS. It will work sometime and will not work other times. That kind of
  12. explains why you don't see this type of program on the market.
  13.  
  14. -----------------------
  15. User-Supported Software
  16. -----------------------
  17.  
  18. This program and documentation are copyrighted by Mark C. DiVecchio.
  19.  
  20. Permission to copy:
  21.  
  22. Individuals, clubs and other non-profit organizations are granted
  23. permission by the author to freely copy this program and documentation
  24. and share it with their members, so long as:
  25.  
  26.      -  No price is charged for the software or documentation.
  27.     However, a distribution cost may be charged for the cost of
  28.     the diskette, so long as it is not more than $9 total.
  29.  
  30.      -  Club members are informed of the user-supported concept and
  31.     encouraged to support it with their copyright fees.
  32.  
  33.      -  The program and documentation are not modified in any way
  34.     and are always distributed together.
  35.  
  36. Schools, universities, and other non-profit organizations are granted
  37. permission by the author to copy LPTx for use on other computers and at
  38. other locations in the organization, so long as:
  39.  
  40.      -  The full fee of $25 has been paid for the original copy of
  41.     the program.
  42.  
  43.      -  A usage fee of $40 is paid for each additional building
  44.     where LPTx will be used. Within each building for which
  45.     the usage fee has been paid, LPTx may be copied freely for
  46.     use on any other computer in that building.  Contact the
  47.     author if you would like to make other arrangements.
  48.  
  49. Commercial users of this program are required to submit the copyright
  50. fee. Commercial and site licenses as well as source code licenses are
  51. available. Contact the author.
  52.  
  53. The User-Supported concept:
  54.  
  55. User-Supported Software
  56.  
  57. If you are using this program and find it to be of value, your copyright
  58. fee will be appreciated. ($25 is suggested)
  59.  
  60.     Mark C. DiVecchio
  61.     9888 Carroll Center Road, Suite 113
  62.     San Diego, CA  92126
  63.     619-549-4056
  64.  
  65. Regardless of whether you pay the copyright fee, you are encouraged to
  66. use, copy and share this program.
  67.  
  68. User-supported software is an experiment in distributing computer
  69. programs, based on these beliefs:
  70.  
  71.       - That the value and utility of software is best assessed by
  72.     the user on his/her own system.
  73.  
  74.      -  That the creation of personal computer software can and
  75.     should be supported by the computing community.
  76.  
  77.      -  That copying of programs should be encouraged, rather than
  78.     restricted.
  79.  
  80. Anyone may request a copy of a user-supported program by sending a blank
  81. double sided double density, 360Kb formatted disk (without DOS) to the
  82. author of the program. An addressed, postage-paid return mailer must
  83. accompany the disk (no exceptions, please). A copy of the program, with
  84. documentation on the disk, will be sent by return mail. The program will
  85. carry a notice suggesting the payment of a copyright fee to the
  86. program's author. Paying that copyright fee is completely voluntary on
  87. the part of each non-commercial user. You can also call my BBS at
  88. 619-549-3927 for the latest news.
  89.  
  90. Free distribution of software and voluntary payment for its use
  91. eliminates costs for advertising and copy protection schemes.
  92.  
  93. Users obtain quality software at reduced cost. They can try it out
  94. before buying, and do so at their own pace and in the comfort of their
  95. own home or office. The best programs will survive, based purely on
  96. their quality and usefulness.
  97.  
  98. Please join the experiment.
  99.  
  100. If you believe in these ideals, the copyright fee is solicited to help
  101. make them work.
  102.  
  103.     Mark C. DiVecchio
  104.     9888 Carroll Center Road, Suite 113
  105.     San Diego, CA  92126
  106.     619-549-4056
  107.     Athena Systems BBS : 619-549-3927
  108.  
  109. ------------------------------------------------------------------------
  110. ------------------------------------------------------------------------
  111. ------------------------------------------------------------------------
  112.  Version 8.00
  113.  
  114.  (C)    Copyright 1990 by Mark C. DiVecchio, All Rights Reserved
  115.  (C)    Copyright 1987 by Kepa Zubeldia, All Rights Reserved
  116.  
  117. DISCLAMER : This program tries to perform a function which is not
  118. supported by DOS. It will work sometime and will not work other times.
  119. That kind of explains why you don't see this type of program on the
  120. market. I have tested it under 3.1 and 3.3. I have not tested it under
  121. DOS 4.x.
  122.  
  123. ------------------------------------------------------------------------
  124.  
  125. First - some thanks... I would like to thank all of the users who have
  126. called me about the earlier versions of LPTx which has been floating
  127. around for about three years. The program has met with mixed success.
  128. There seems to be no pattern as to when the program works and when it
  129. doesn't. I am still searching for the solution to this very difficult
  130. problem. This version and the versions which preceded it are attempts to
  131. perform the same function with a different algorithm. versions 3.00,
  132. 4.00, 5.00, 6.00, and 8.00 are not replacements or upgrades of each
  133. other but just alternative implementations. Version 7.00 is version 6.00
  134. with a pop-up window.
  135.  
  136. A special word of Thanks to Kepa Zubeldia who added the popup window
  137. enhancements for version 7.00 which were carried forward to later
  138. versions.
  139.  
  140. Version 8.00 has benefited from a really good article ( # 11 ) on TSR's
  141. in 'The MS-DOS Encyclopedia'. and from an article by Tom Kihlken in Vol
  142. 6 No 22 of PC Magazine.
  143.  
  144. ------------------------------------------------------------------------
  145.  
  146. Have you ever wanted to get some data from your screen into a program?
  147. Have you ever wanted to grab onto some printer data and put it into a
  148. disk file but the program you are using does not have that as a option?
  149. Well here is the answer to your problem. This program will grab onto
  150. anything sent out of a line printer port as long as the program uses the
  151. standard BIOS INT 17h call. This version works with Shift-PrtSc or
  152. Ctrl-PrtSc but does not work with the DOS TYPE command.
  153.  
  154. This program intercepts the BIOS interrupt 17h, the line printer
  155. interrupt. It will redirect the output of LPT1, LPT2, or LPT3 to a disk
  156. file. All three redirections may be active at the same time.
  157.  
  158. This version of LPTx counts on the PC having some "free time" in order
  159. to write the data to disk. The program gathers data into a large buffer
  160. and during timer interrupts and keyboard idle periods, it writes it to
  161. disk. DOS must not be in its critical section for the write to take
  162. place. LPTx does not work with the DOS TYPE apparently because the
  163. critical section flag is always set when the timer interrupts occur. It
  164. should work with most user programs since the critical section flag is
  165. not set in user programs and therefore will not be set when timer
  166. interrupts occur.
  167.  
  168. If you would like the other versions of LPTx, I will be happy to send
  169. them to you. Just send me a formatted 360K DSDD floppy (no DOS on
  170. diskette) along with a post-paid, self-addressed floppy mailer. I will
  171. send you all current versions that are active. If you received this disk
  172. directly from me, all of the different versions are already on the
  173. diskette. You can also call my BBS at 619-549-3927.
  174.  
  175. LPTx versions 3.00-7.00 requires DOS 2.0 or later. LPTx version 8.00
  176. requires DOS 3.0 or later.
  177.  
  178. Calling sequence:
  179.  
  180. lptx [-?] [-m] [-s] [-l] [-i] {-1,-2,-3} {[-c] [-o] [-a] [<d:[pathname]filename>]}
  181.  
  182. Note: -1, -2, and -3 are mutually exclusive
  183.       -o, -a, and -c are mutually exclusive
  184.  
  185. Where:
  186.  
  187. -1 means redirect LPT1, -2 means redirect LPT2, -3 means redirect LPT3.
  188. This option must appear before -c, -o or -a.
  189.  
  190. -o means start the redirection to file specified.
  191.  
  192. If redirection is already in progress for the selected line printer, the
  193. old file will be closed first. (If you do not specify -o but you do
  194. specify a line printer, LPTx will use either the last file name that you
  195. gave when you loaded LPTx or will use the file named LPTXy.LST which it
  196. will create in the root directory on the default drive - where y is 1,
  197. 2, or 3.)
  198.  
  199. It is not necessary that you specify the complete path name for the
  200. file. LPTx will create the file in the default directory if you don't
  201. specify a directory. LPTx will always be able to find the file because
  202. it saves the complete path.
  203.  
  204. If you just specify a filename, LPTx will assume -1 and -o.
  205.  
  206. If the file already exists, LPTx asks if you want to overwrite it. You
  207. can answer :
  208.     y        LPTx overwrites the file
  209.     a        LPTx appends to the file (just like -a option)
  210.     q or anything else
  211.             Terminates LPTx
  212.  
  213. -a means the same as -o except that if there is a file with the same
  214. name already on the disk, LPTx will append the text to that file without
  215. asking the user for confirmation. In order for this to work properly,
  216. the file on the disk must NOT be terminated by a control-Z (1Ah).
  217. Otherwise you may not be able to see the text that will be appended
  218. after the control-Z.
  219.  
  220. LPTx will not put a control-Z at the end of its files. If you need a
  221. control-Z at the end, you can use the copy command, with the
  222. concatenation option (copy x+y z) to add a control-Z. See your DOS
  223. manual.
  224.  
  225. -c means close the file and send all further output directly to the line
  226. printer.
  227.  
  228. If neither the -o or the -c option is specified and a filename is not
  229. given, LPTx just displays the program status.
  230.  
  231. -? displays a short help screen.
  232.  
  233. -l tells LPTx to strip linefeed characters from the data as it is being
  234. redirected.
  235.  
  236. -i removes LPTx from the interrupt chain. This effectively inactivates
  237. the program. The memory which it occupies is freed if possible.
  238.  
  239. -m the first time LPTx is run, tells the pop-up window to ignore the
  240. color card and use monochrome attributes. Makes a more readable screen
  241. on monochrome monitors with graphics adapter cards.
  242.  
  243. -s : normally, LPTx runs quietly. This option causes it to beep and honk
  244. as follows :
  245.  
  246.     4 beeps on a disk error. LPTx terminates redirection
  247.     1 beep on each successful write to disk
  248.     1 honk on the queuing of a disk write request
  249.  
  250. LPTx always generates 2 beeps on a buffer overflow and terminates
  251. redirection
  252.  
  253. examples:
  254.  
  255. lptx            Displays the program status
  256.  
  257. lptx -?            Displays a HELP screen
  258.  
  259. lptx -1            redirects LPT1 output to file named
  260.             PTX1.LST in the root directory
  261.             on the default drive or the last
  262.             named file.
  263.  
  264. lptx -o a:\able.xxx    redirects LPT1 output to file named
  265.     or        a:\able.xxx. Any open redirection
  266. lptx a:\able.xxx    disk file for LPT1 is closed.
  267.  
  268. lptx -2 b:xx.lst    redirects LPT2 output to file named
  269.             XX.LST in the default directory
  270.             on drive B:. Any open redirection
  271.             disk file for LPT2 is closed.
  272.  
  273. lptx -3 d:\ab\cd\file.lst    redirects LPT3 output to the file named
  274.                 file.lst in the directory ab\cd on drive
  275.                 d:.
  276.  
  277. lptx -c            closes any disk files open for LPT1 and sends
  278.     or        the output back to the line printer
  279. lptx -1 -c        If no redirection is taking place to LPT1,
  280.             this is a NOP. LPT2 and LPT3 are not
  281.             affected.
  282.  
  283. lptx -2 -c        closes any disk file open for LPT2 and
  284.             sends the output back to line printer.
  285.             if no redirection is taking place to LPT2,
  286.             this is a NOP. LPT1 and LPT3 are not
  287.             affected.
  288.  
  289. lptx -i            LPTx is unhooked from the interrupt chain
  290.             and removed from memory if possible.
  291.  
  292. By redirecting LPT2 or LPT3 to a disk file, you can in effect have 2 or
  293. 3 printers on your system. LPT1 can be your physical printer and you can
  294. have LPT2 output going to disk. When you redirect LPT2 or LPT3, LPT1
  295. works normally.
  296.  
  297. If you are redirecting to a diskette file, do not remove the diskette
  298. once the redirection starts. I recommend redirecting to a hard disk or a
  299. RAM disk.
  300.  
  301. If LPTx encounters any kind of error during the redirection, it
  302. terminates operation and sends output back to the line printer. It does
  303. not display anything but beeps the speaker. Four beeps indicates a DOS
  304. disk access error. Two beeps indicates an internal buffer overflow
  305. error. This prevents your currently running program from possibly
  306. getting destroyed. An error with LPT1 redirection does not shut down
  307. LPT2 or LPT3 redirection.
  308.  
  309. LPTx captures the int 17h interrupt vector. Problems may occur with
  310. print spoolers which also take over the int 17h  vector. You can be sure
  311. that LPTx works correctly by running LPTx before you run your print
  312. spooler. LPTx will be transparent to the print spooler but your print
  313. spooler may not be transparent to LPTx. LPTx works fine with IBM's PRINT
  314. command.
  315.  
  316. LPTx also captures the int 24h critical error interrupt vector. This is
  317. done only for the period that LPTx is using the disk. This prevents the
  318. generation of funny error messages in the middle of other programs that
  319. you may be running. (LPTx just beeps 4 times and clears itself out of
  320. way if a disk error occurs).
  321.  
  322. This version of LPTx can redirect all three printers to three different
  323. files with all 3 active at the same time.
  324.  
  325. LPTx worked correctly when I tested it with:
  326.  
  327.     1. WordPerfect 5.1
  328.     2. the PKUNZIP utility with the "-pa1" option
  329.         and output redirected to prn
  330.     3. shift PrtSc
  331.     4. DOS PRINT utility
  332.     5. Lotus 123 Release 3.0
  333.     6. Finalword 2.00
  334.  
  335. LPTx did not work with:
  336.  
  337.     1. ctrl PrtSc followed by the DOS 'type' command
  338.     2. copy <file> prn
  339.     3. type <file> >prn
  340.  
  341.     Generally it does not work with built in DOS commands when
  342.     the output generated is more than 4096 bytes. What happens is
  343.     that DOS is continually busy and does not permit LPTx to empty
  344.     its buffer.
  345.  
  346. If you find any bugs in this program, I would appreciate it if you would
  347. drop me a line and let me know. Use the address above or the BBS.
  348.  
  349. Updates and new versions of this program can be found on the Athena
  350. Systems BBS at 619-549-3927.
  351.  
  352. Versions 7.00 and later contain code for a pop-up window that allows the
  353. user to turn the redirection ON or OFF from within an application
  354. program. This window has been tested with Monochrome, Color, and EGA
  355. adapter cards, and with monochrome and color monitors. If DOS is busy
  356. when you try to open the window, you will get no response. In that case,
  357. press Alt-PrtSc again until the window opens. You can only redirect
  358. printers to files that have  been previously opened with the command
  359. line version of LPTx.
  360.  
  361. For Example :
  362.  
  363. You first must start LPTx from the command line as usual :
  364.  
  365. lptx output.fil
  366.  
  367. Then you can press Alt-PrtSc and a pop-up window will appear. When it
  368. does, the up and down arrow keys select a printer and the right and left
  369. arrow keys select redirection. The pop-up will state "to file" or "to
  370. printer" indicating the state of the redirection.
  371.  
  372. Press <Enter> or <Esc> to close the window.
  373.  
  374. Remember that you must start LPTx from the command line before the
  375. pop-up will let you turn redirection on or off.
  376.  
  377. Another change in LPTx version 7.00 is the capability of appending to an
  378. existing file, instead of having to use a new file every time. This
  379. feature forced the sacrifice of the control-Z added at the end of the
  380. file.
  381.  
  382. Version 8.00 is a further upgrade in performance and comes in two
  383. flavors. Version 8.00 is the traditional 3 printer support version each
  384. with 4K buffers. Version 8.00a is 1 printer version with a single 40K
  385. buffer.
  386.  
  387. Version 8.00 uses features found only on DOS 3.0 and later versions of
  388. DOS. It will not run under earlier versions.
  389.