LPTx : Line Printer Output Capture Routine ------------------------------------------------------------------------ Version 7.00 (C) Copyright 1987 by Mark DiVecchio, All Rights Reserved (C) Copyright 1987 by Kepa Zubeldia, All Rights Reserved This program is released for use in non-commercial environments. I ask commercial users to register the program with a $25 copyright fee for each site (any number of users and computers) at which the program is used. DISCLAMER : This program tries to perform a function which is not supported by DOS. It will work sometime and will not work other times. That kind of explains why you don't see this type of program on the market. I have tested it under DOS 2.x and 3.x. In particular, under 3.x, I used dBase-II. I have not tested it with dBase-III or dBase-III+. Mark C. DiVecchio 10435 Mountain Glen Terrace San Diego, CA 92131 619-566-6810 ------------------------------------------------------------------------ First - some thanks... I would like to thank all of the users who have called me about the earlier versions of LPTx which has been floating around for about a year. The program has met with mixed success. There seems to be no pattern as to when the program works and when it doesn't. I am still searching for the solution to this very difficult problem. This version and versions 4.x and 5.x which preceeded it are attempts to perform the same function with a different algorithm. Version 3.00, 4.00, 5.00 and 6.00 are not replacements or upgrades of each other but just alternative implementations. Version 7.00 is version 6.00 with a pop-up window. A special word of Thanks to Kepa Zubeldia who added the enhancements for version 7.00. ------------------------------------------------------------------------ Have you ever wanted to get some data from your screen into a program? Have you ever wanted to grab onto some printer data and put it into a disk file but the program you are using does not have that as a option? Well here is the answer to your problem. This program will grab onto anything sent out of a line printer port as long as the program uses the standard BIOS INT 17h call. This version works with Shift-PrtSc or Ctrl-PrtSc but does not work with the DOS TYPE command. This program intercepts the BIOS interrupt 17h, the line printer interrupt. It will redirect the output of LPT1, LPT2, or LPT3 to a disk file. All three redirections may be active at the same time. This version of LPTx counts on the PC having some "free time" in order to write the data to disk. The program gathers data into a large buffer and during timer interrupts and keyboard idle periods, it writes it to disk. DOS must not be in its critical section for the write to take place. LPTx does not work with the DOS TYPE apparently because the critical section flag is always set when the timer interrupts occur. It should work with most user programs since the critical section flag is not set in user programs and therefore will not be set when timer interrupts occur. Look at the Assembly Language Source which you should have received with this documentation file. If you would like the other versions of LPTx, I will be happy to send them to you. Just send me a formatted 360K DSDD floppy (no DOS on diskette) along with a post-paid, self-addressed floppy mailer. I will send you all current versions that are active. If you received this disk directly from me, all of the different versions are already on the diskette. LPTx requires DOS 2.0 or later. It has been tested on version 3.1 of DOS as well. Calling sequence: lptx [?] [-m] [-x] [-l] [-i] {-1,-2,-3} {-c -o -a } where -1 means redirect LPT1, -2 means redirect LPT2, -3 means redirect LPT3 This option must appear first -o means start the redirection to file specified. If redirection is already in progress for the selected line printer, the old file will be closed first. (If you do not specify -o but you do specify a line printer, LPTx will use either the last file name that you gave when you loaded LPTx or will use the file named LPTXy.LST which it will create in the root directory on the default drive - where y is 1, 2, or 3.) It is not necessary that you specify the complete path name for the file. LPTx will create the file in the default directory if you don't specify a directory. LPTx will always be able to find the file because it saves the complete path. -a means the same as -o except that if there was a file with the same name already on the disk, it will append the text to that file without asking the user for confirmation. In order for this to work properly, the file on the disk must NOT be terminated by a control-Z (1Ah). Otherwise you may not be able to see the text that will be appended after the control-Z. LPTx will not put a control-Z at the end of its files. If you need a control-Z at the end, you can use the copy command, with the concatenation option (copy x+y z) to add a control-Z. See your DOS manual. -c means close the file and send all further output directly to the line printer. If neither the -o or the -c option is specified, LPTx just displays the program status. -? displays a short help screen. -x tells LPTx to ignore the DOS Critical Section Flag. Use this option only with great care. LPTx may do unusual things if the flag is ignored. -l tells LPTx to strip linefeed characters from the data as it is being redirected. -i removes LPTx from the interrupt chain. This effectively inactivates the program. The memory which it occupies is not freed. -m the first time LPTx is run, tells the pop-up window to ignore the color card and use monochrome attributes. Makes a more readable screen on monochrome monitors with graphics adaptor cards. note: -1, -2, and -3 are mutually exclusive -o and -c are mutually exclusive examples: lptx Displays the program status lptx ? Displays a HELP screen lptx -1 redirects LPT1 output to file named LPTX1.LST in the root directory on the default drive or the last named file. lptx -o a:\able.xxx redirects LPT1 output to file named or a:\able.xxx. Any open redirection lptx a:\able.xxx disk file for LPT1 is closed. lptx -2 b:xx.lst redirects LPT2 output to file named XX.LST in the default directory on drive B:. Any open redirection disk file for LPT2 is closed. lptx -3 d:\ab\cd\file.lst redirects LPT3 output to the file named file.lst in the directory ab\cd on drive d:. lptx -c closes any disk files open for LPT1 and sends or the output back to the line printer lptx -1 -c If no redirection is taking place to LPT1, this is a NOP. LPT2 and LPT3 are not affected. lptx -2 -c closes any disk file open for LPT2 and sends the output back to line printer. if no redirection is taking place to LPT2, this is a NOP. LPT1 and LPT3 are not affected. By redirecting LPT2 or LPT3 to a disk file, you can in effect have 2 or 3 printers on your system. LPT1 can be your physical printer and you can have LPT2 output going to disk. When you redirect LPT2 or LPT3, LPT1 works normally. If you are redirecting to a diskette file, do not remove the diskette once the redirection starts. I recommend redirecting to a hard disk or a RAM disk. If LPTx encounters any kind of error during the redirection, it terminates operation and sends output back to the line printer. It does not display anything but beeps the speaker. Four beeps indicates a DOS disk access error. Two beeps indicates an internal buffer overflow error. This prevents your currently running program from possibly getting destroyed. An error with LPT1 redirection does not shut down LPT2 or LPT3 redirection. LPTx captures the int 17h interrupt vector. Problems may occur with print spoolers which also take over the int 17h vector. You can be sure that LPTx works correctly by running LPTx before you run your print spooler. LPTx will be transparent to the print spooler but your print spooler may not be transparent to LPTx. LPTx works fine with IBM's PRINT command. LPTx also captures the int 24h critical error interrupt vector. This is done only for the period that LPTx is using the disk. This prevents the generation of funny error messages in the middle of other programs that you may be running. (LPTx just beeps 4 times and clears itself out of way if a disk error occurs). This version of LPTx can redirect all three printers to three different files with all 3 active at the same time. LPTx worked correctly when I tested it with: 1. dBaseII, 2. the ARC utility with the "p" option and output redirected to prn, 3. shift PrtSc, 4. DOS PRINT utility, 5. Lotus 123, 6. dir > prn, LPTx did not work with: 1. The DOS TYPE command, 2. The DOS COPY command, 3. Version 6.00 of LPTx uses about 20K of memory for the resident data buffers and interrupt handler. This is greater than the previous versions of LPTx because I made the disk buffers larger. If you modify or find any bugs in this program, I would appreciate it if you would drop me a line with the changes. Use the address above. Updates and new versions of this program can be found on the RBBS at 619-741-3412. Version 7.00 contains the code for a pop-up window that allows the user to turn the redirection ON or OFF from within an application program. This window has been tested with Monochrome, Color, and EGA adaptor cards, and with monochrome and color monitors. If DOS is busy when you try to open the window, you will get no response. In these cases, hold down Alt-PrtSc until the window opens. You can only redirect printers to files that have been previously opened with the command line version of LPTx. For Example : You first must start LPTx from the command line as usual : lptx output.fil Then you can press Alt-PrtSc and a pop-up window will appear. When it does, the up and down arrow keys select a printer and the right and left arrow keys select redirection. The pop-up will state "to file" or "to printer" indicating the state of the redirection. Press or to close the window. Remember that you must start LPTx from the command line before the pop-up will let you turn redirection on or off. Another change in LPTx version 7.00 is the capability of appending to an existing file, instead of having to use a new file every time. This feature forced the sacrifice of the control-Z added at the end of the file. Version 7.00 now assembles under Microsoft 5.0