Home » CEEFAX disks » telesoftware12.adl » 04-02-89/Pstat\DOC
04-02-89/Pstat\DOC
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » CEEFAX disks » telesoftware12.adl |
Filename: | 04-02-89/Pstat\DOC |
Read OK: | ✔ |
File size: | 1751 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
PSTAT ~~~~~~~ Printer STATus (c) Colin J Smith September 1988 Files on disk ~~~~~~~~~~~~~~~ PSTAT.EXE ; the program to read printer status PSTAT.C ; 'C' source code PSTAT.DOC ; this file PTEST.BAT ; batch file to test operation of PSTAT.EXE PSTAT was written in the 'C' language. The 'C' source is included and should compile in 'Borland Turbo C', 'Microsoft C', or 'Zortech C++'. PSTAT was written to help obtain information about the printer and it's ports easily. Instead of assuming the user has made sure a printer is connected, switched on, has enough paper etc, this program enables the exact state of a printer connected to one of the parallel printer ports to be determined by software means. It is designed to work with batch files interfaced using the ERRORLEVEL. Users can create their own customised batch files which will allow them to be certain of the state their printer is in i.e. before running a program which will use the printer. It may also be used to check using software means whether the printer is actually connected and so highlight a possible bad connection etc. The main use of PSTAT is where batch files actually control some output to a printer. If the printer is not in the correct state i.e. online, has paper, is connected then the output will fail and horribly messages like -'abort, retry, ignore?' will crop up. By testing these states using PSTAT in the first place this can be avoided and so programs are more user friendly and more professional by not making assumptions on the state of the system. Using PSTAT ~~~~~~~~~~~~~ The syntax of PSTAT is:- PSTAT ; lists the information on how to use PSTAT ; and the ERRORLEVEL values returned PSTAT p ; performs a check of the port specified ; by 'p' e.g. PSTAT 1 - checks the status ; of the parallel printer port LPT1. The ; results of the test are returned to ; the ERRORLEVEL. ; p=(1-4) 1=LPT1 [PRN] 2=LPT2 3=LPT3 4=LPT4 --ERRORLEVEL returned means if 0 - printer connected to port but OFF if 1 - printer connected to port and ON if 2 - specified port does not exist so printer connection impossible if 3 - printer not connected to specified port PSTAT p s ; performs a check of a certain possible ; state of a printer connected to port 'p'. ; 'p' is either 1,2,3 or 4 specifying LPT1, ; LPT2, LPT3 etc while 's' specifies the state ; to check if it's set e.g. PSTAT 1 4 - looks ; at a printer connected to port LPT1 to see ; if it is 'out of paper'. If the printer is ; out of paper the ERRORLEVEL returns 1 for ; TRUE otherwise 0 for NOT TRUE. ; p=(1-4) s=(1-6) 1=LPT1 1=Device time out? 2=LPT2 2=I/O error? 3=LPT3 3=Selected? 4=LPT4 4=Out of Paper? 5=Acknowledge? 6=Not Busy? --ERRORLEVEL returned means if 0 - status is NOT TRUE (e.g. for s=2, means NO I/O error) if 1 - status is TRUE (e.g. for s=2, means YES I/O error) Using PTEST.BAT ~~~~~~~~~~~~~~~~~ PTEST.BAT is a batch file program which shows one of the applications of which PSTAT can be used. It reports back the status of the 4 possible parallel printer ports and the status of the printer. To run PTEST use:- PTEST <Return> PTEST may be slow depending on the area of the floppy disk it is positioned because it needs to access PSTAT.EXE a few times. In your own programs you may only access PSTAT.EXE a few times so this should not be a problem. If your batch files will access PSTAT.EXE a great deal then you should either put PSTAT.EXE onto a 'ramdisk' or your hard disk to offer best efficiency. In your own programs you may only need to check if the printer is 'online' or just check if there is enough paper in the printer and so ask the user to insert some more paper. You can check as many or as few states as you like. Using the ERRORLEVEL value ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PSTAT returns an ERRORLEVEL value and this in turn can be read by batch files:- batch file extract:- PSTAT 2 ; batch file runs PSTAT to check port LPT2 (2) IF ERRORLEVEL==3 GOTO NOTCON ; if the ERRORLEVEL return value was 3 IF ERRORLEVEL==2...... ; then it means that no printer was connected ; and so a jump would be made to NOTCON to ; probably ask the user to connect a printer ; to port LPT2 (2). The method of checking the printer is to run PSTAT and then using ERRORLEVEL to determine the result and acting accordingly. You don't have any excuse for writing those batch files now!, Enjoy!
00000000 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |.. | 00000010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000020 20 20 20 20 20 20 20 50 53 54 41 54 0d 0a 20 20 | PSTAT.. | 00000030 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 00000050 20 20 7e 7e 7e 7e 7e 7e 7e 0d 0a 20 20 20 20 20 | ~~~~~~~.. | 00000060 20 20 20 20 20 20 20 20 20 20 20 50 72 69 6e 74 | Print| 00000070 65 72 20 53 54 41 54 75 73 20 28 63 29 20 43 6f |er STATus (c) Co| 00000080 6c 69 6e 20 4a 20 53 6d 69 74 68 20 53 65 70 74 |lin J Smith Sept| 00000090 65 6d 62 65 72 20 31 39 38 38 0d 0a 0d 0a 0d 0a |ember 1988......| 000000a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 000000c0 20 20 46 69 6c 65 73 20 6f 6e 20 64 69 73 6b 0d | Files on disk.| 000000d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 000000e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000000f0 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e | ~~~~~~~~~~~~~~~| 00000100 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 50 |.. P| 00000110 53 54 41 54 2e 45 58 45 20 20 3b 20 74 68 65 20 |STAT.EXE ; the | 00000120 70 72 6f 67 72 61 6d 20 74 6f 20 72 65 61 64 20 |program to read | 00000130 70 72 69 6e 74 65 72 20 73 74 61 74 75 73 0d 0a |printer status..| 00000140 20 20 20 20 20 20 20 20 20 20 20 20 20 50 53 54 | PST| 00000150 41 54 2e 43 20 20 20 20 3b 20 27 43 27 20 73 6f |AT.C ; 'C' so| 00000160 75 72 63 65 20 63 6f 64 65 0d 0a 20 20 20 20 20 |urce code.. | 00000170 20 20 20 20 20 20 20 20 50 53 54 41 54 2e 44 4f | PSTAT.DO| 00000180 43 20 20 3b 20 74 68 69 73 20 66 69 6c 65 0d 0a |C ; this file..| 00000190 20 20 20 20 20 20 20 20 20 20 20 20 20 50 54 45 | PTE| 000001a0 53 54 2e 42 41 54 20 20 3b 20 62 61 74 63 68 20 |ST.BAT ; batch | 000001b0 66 69 6c 65 20 74 6f 20 74 65 73 74 20 6f 70 65 |file to test ope| 000001c0 72 61 74 69 6f 6e 20 6f 66 20 50 53 54 41 54 2e |ration of PSTAT.| 000001d0 45 58 45 0d 0a 0d 0a 0d 0a 20 20 20 50 53 54 41 |EXE...... PSTA| 000001e0 54 20 20 77 61 73 20 20 77 72 69 74 74 65 6e 20 |T was written | 000001f0 20 69 6e 20 20 74 68 65 20 27 43 27 20 6c 61 6e | in the 'C' lan| 00000200 67 75 61 67 65 2e 20 20 20 54 68 65 20 20 27 43 |guage. The 'C| 00000210 27 20 20 73 6f 75 72 63 65 20 20 69 73 0d 0a 20 |' source is.. | 00000220 20 20 69 6e 63 6c 75 64 65 64 20 61 6e 64 20 73 | included and s| 00000230 68 6f 75 6c 64 20 63 6f 6d 70 69 6c 65 20 69 6e |hould compile in| 00000240 20 27 42 6f 72 6c 61 6e 64 20 54 75 72 62 6f 20 | 'Borland Turbo | 00000250 43 27 2c 20 27 4d 69 63 72 6f 73 6f 66 74 20 20 |C', 'Microsoft | 00000260 43 27 2c 0d 0a 20 20 20 6f 72 20 27 5a 6f 72 74 |C',.. or 'Zort| 00000270 65 63 68 20 43 2b 2b 27 2e 0d 0a 0d 0a 0d 0a 20 |ech C++'....... | 00000280 20 20 50 53 54 41 54 20 20 77 61 73 20 77 72 69 | PSTAT was wri| 00000290 74 74 65 6e 20 74 6f 20 68 65 6c 70 20 6f 62 74 |tten to help obt| 000002a0 61 69 6e 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 |ain information | 000002b0 61 62 6f 75 74 20 20 74 68 65 20 20 70 72 69 6e |about the prin| 000002c0 74 65 72 0d 0a 20 20 20 61 6e 64 20 20 69 74 27 |ter.. and it'| 000002d0 73 20 20 70 6f 72 74 73 20 65 61 73 69 6c 79 2e |s ports easily.| 000002e0 20 20 49 6e 73 74 65 61 64 20 6f 66 20 61 73 73 | Instead of ass| 000002f0 75 6d 69 6e 67 20 74 68 65 20 75 73 65 72 20 20 |uming the user | 00000300 68 61 73 20 20 6d 61 64 65 0d 0a 20 20 20 73 75 |has made.. su| 00000310 72 65 20 20 61 20 70 72 69 6e 74 65 72 20 69 73 |re a printer is| 00000320 20 63 6f 6e 6e 65 63 74 65 64 2c 20 73 77 69 74 | connected, swit| 00000330 63 68 65 64 20 6f 6e 2c 20 68 61 73 20 65 6e 6f |ched on, has eno| 00000340 75 67 68 20 70 61 70 65 72 20 20 65 74 63 2c 0d |ugh paper etc,.| 00000350 0a 20 20 20 74 68 69 73 20 20 70 72 6f 67 72 61 |. this progra| 00000360 6d 20 65 6e 61 62 6c 65 73 20 74 68 65 20 65 78 |m enables the ex| 00000370 61 63 74 20 73 74 61 74 65 20 6f 66 20 61 20 70 |act state of a p| 00000380 72 69 6e 74 65 72 20 20 63 6f 6e 6e 65 63 74 65 |rinter connecte| 00000390 64 20 20 74 6f 0d 0a 20 20 20 6f 6e 65 20 20 6f |d to.. one o| 000003a0 66 20 74 68 65 20 70 61 72 61 6c 6c 65 6c 20 70 |f the parallel p| 000003b0 72 69 6e 74 65 72 20 70 6f 72 74 73 20 74 6f 20 |rinter ports to | 000003c0 62 65 20 64 65 74 65 72 6d 69 6e 65 64 20 20 62 |be determined b| 000003d0 79 20 20 73 6f 66 74 77 61 72 65 0d 0a 20 20 20 |y software.. | 000003e0 6d 65 61 6e 73 2e 0d 0a 0d 0a 0d 0a 20 20 20 49 |means....... I| 000003f0 74 20 20 69 73 20 20 64 65 73 69 67 6e 65 64 20 |t is designed | 00000400 74 6f 20 77 6f 72 6b 20 77 69 74 68 20 62 61 74 |to work with bat| 00000410 63 68 20 66 69 6c 65 73 20 20 69 6e 74 65 72 66 |ch files interf| 00000420 61 63 65 64 20 20 75 73 69 6e 67 20 20 74 68 65 |aced using the| 00000430 0d 0a 20 20 20 45 52 52 4f 52 4c 45 56 45 4c 2e |.. ERRORLEVEL.| 00000440 20 20 20 55 73 65 72 73 20 63 61 6e 20 63 72 65 | Users can cre| 00000450 61 74 65 20 74 68 65 69 72 20 6f 77 6e 20 63 75 |ate their own cu| 00000460 73 74 6f 6d 69 73 65 64 20 20 62 61 74 63 68 20 |stomised batch | 00000470 20 66 69 6c 65 73 0d 0a 20 20 20 77 68 69 63 68 | files.. which| 00000480 20 77 69 6c 6c 20 61 6c 6c 6f 77 20 74 68 65 6d | will allow them| 00000490 20 74 6f 20 62 65 20 63 65 72 74 61 69 6e 20 6f | to be certain o| 000004a0 66 20 74 68 65 20 73 74 61 74 65 20 74 68 65 69 |f the state thei| 000004b0 72 20 70 72 69 6e 74 65 72 20 69 73 0d 0a 20 20 |r printer is.. | 000004c0 20 69 6e 20 69 2e 65 2e 20 62 65 66 6f 72 65 20 | in i.e. before | 000004d0 72 75 6e 6e 69 6e 67 20 61 20 70 72 6f 67 72 61 |running a progra| 000004e0 6d 20 77 68 69 63 68 20 77 69 6c 6c 20 75 73 65 |m which will use| 000004f0 20 74 68 65 20 70 72 69 6e 74 65 72 2e 20 20 20 | the printer. | 00000500 49 74 0d 0a 20 20 20 6d 61 79 20 20 61 6c 73 6f |It.. may also| 00000510 20 20 62 65 20 20 75 73 65 64 20 74 6f 20 63 68 | be used to ch| 00000520 65 63 6b 20 75 73 69 6e 67 20 20 73 6f 66 74 77 |eck using softw| 00000530 61 72 65 20 20 6d 65 61 6e 73 20 20 77 68 65 74 |are means whet| 00000540 68 65 72 20 20 74 68 65 0d 0a 20 20 20 70 72 69 |her the.. pri| 00000550 6e 74 65 72 20 20 69 73 20 20 61 63 74 75 61 6c |nter is actual| 00000560 6c 79 20 63 6f 6e 6e 65 63 74 65 64 20 61 6e 64 |ly connected and| 00000570 20 73 6f 20 68 69 67 68 6c 69 67 68 74 20 61 20 | so highlight a | 00000580 20 70 6f 73 73 69 62 6c 65 20 20 62 61 64 0d 0a | possible bad..| 00000590 20 20 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 65 74 | connection et| 000005a0 63 2e 0d 0a 0d 0a 0d 0a 20 20 20 54 68 65 20 6d |c....... The m| 000005b0 61 69 6e 20 75 73 65 20 6f 66 20 50 53 54 41 54 |ain use of PSTAT| 000005c0 20 69 73 20 77 68 65 72 65 20 62 61 74 63 68 20 | is where batch | 000005d0 66 69 6c 65 73 20 61 63 74 75 61 6c 6c 79 20 63 |files actually c| 000005e0 6f 6e 74 72 6f 6c 20 20 73 6f 6d 65 0d 0a 20 20 |ontrol some.. | 000005f0 20 6f 75 74 70 75 74 20 74 6f 20 61 20 70 72 69 | output to a pri| 00000600 6e 74 65 72 2e 20 20 49 66 20 74 68 65 20 70 72 |nter. If the pr| 00000610 69 6e 74 65 72 20 69 73 20 6e 6f 74 20 69 6e 20 |inter is not in | 00000620 74 68 65 20 63 6f 72 72 65 63 74 20 20 73 74 61 |the correct sta| 00000630 74 65 0d 0a 20 20 20 69 2e 65 2e 20 20 6f 6e 6c |te.. i.e. onl| 00000640 69 6e 65 2c 20 68 61 73 20 70 61 70 65 72 2c 20 |ine, has paper, | 00000650 69 73 20 63 6f 6e 6e 65 63 74 65 64 20 74 68 65 |is connected the| 00000660 6e 20 74 68 65 20 6f 75 74 70 75 74 20 20 77 69 |n the output wi| 00000670 6c 6c 20 20 66 61 69 6c 0d 0a 20 20 20 61 6e 64 |ll fail.. and| 00000680 20 68 6f 72 72 69 62 6c 79 20 6d 65 73 73 61 67 | horribly messag| 00000690 65 73 20 6c 69 6b 65 20 2d 27 61 62 6f 72 74 2c |es like -'abort,| 000006a0 20 72 65 74 72 79 2c 20 69 67 6e 6f 72 65 3f 27 | retry, ignore?'| 000006b0 20 77 69 6c 6c 20 63 72 6f 70 20 75 70 2e 0d 0a | will crop up...| 000006c0 20 20 20 42 79 20 20 74 65 73 74 69 6e 67 20 74 | By testing t| 000006d0 68 65 73 65 20 73 74 61 74 65 73 20 75 73 69 6e |hese states usin| 000006e0 67 20 50 53 54 41 54 20 69 6e 20 74 68 65 20 66 |g PSTAT in the f| 000006f0 69 72 73 74 20 70 6c 61 63 65 20 74 68 69 73 20 |irst place this | 00000700 20 63 61 6e 0d 0a 20 20 20 62 65 20 20 61 76 6f | can.. be avo| 00000710 69 64 65 64 20 20 61 6e 64 20 20 73 6f 20 70 72 |ided and so pr| 00000720 6f 67 72 61 6d 73 20 61 72 65 20 6d 6f 72 65 20 |ograms are more | 00000730 20 75 73 65 72 20 20 66 72 69 65 6e 64 6c 79 20 | user friendly | 00000740 20 61 6e 64 20 20 6d 6f 72 65 0d 0a 20 20 20 70 | and more.. p| 00000750 72 6f 66 65 73 73 69 6f 6e 61 6c 20 20 62 79 20 |rofessional by | 00000760 20 6e 6f 74 20 20 6d 61 6b 69 6e 67 20 61 73 73 | not making ass| 00000770 75 6d 70 74 69 6f 6e 73 20 6f 6e 20 20 74 68 65 |umptions on the| 00000780 20 20 73 74 61 74 65 20 20 6f 66 20 20 74 68 65 | state of the| 00000790 0d 0a 20 20 20 73 79 73 74 65 6d 2e 0d 0a 0d 0a |.. system.....| 000007a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |.. | 000007b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000007c0 20 20 20 20 55 73 69 6e 67 20 50 53 54 41 54 0d | Using PSTAT.| 000007d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 000007e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000007f0 20 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0d | ~~~~~~~~~~~~~.| 00000800 0a 20 20 20 54 68 65 20 73 79 6e 74 61 78 20 6f |. The syntax o| 00000810 66 20 50 53 54 41 54 20 69 73 3a 2d 0d 0a 0d 0a |f PSTAT is:-....| 00000820 0d 0a 20 20 20 20 20 20 20 20 50 53 54 41 54 20 |.. PSTAT | 00000830 20 20 20 20 20 20 20 20 20 20 3b 20 6c 69 73 74 | ; list| 00000840 73 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f |s the informatio| 00000850 6e 20 6f 6e 20 68 6f 77 20 74 6f 20 75 73 65 20 |n on how to use | 00000860 50 53 54 41 54 0d 0a 20 20 20 20 20 20 20 20 20 |PSTAT.. | 00000870 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | ;| 00000880 20 61 6e 64 20 74 68 65 20 45 52 52 4f 52 4c 45 | and the ERRORLE| 00000890 56 45 4c 20 76 61 6c 75 65 73 20 72 65 74 75 72 |VEL values retur| 000008a0 6e 65 64 0d 0a 0d 0a 20 20 20 20 20 20 20 20 50 |ned.... P| 000008b0 53 54 41 54 20 70 20 20 20 20 20 20 20 20 20 3b |STAT p ;| 000008c0 20 70 65 72 66 6f 72 6d 73 20 61 20 63 68 65 63 | performs a chec| 000008d0 6b 20 6f 66 20 74 68 65 20 70 6f 72 74 20 73 70 |k of the port sp| 000008e0 65 63 69 66 69 65 64 0d 0a 20 20 20 20 20 20 20 |ecified.. | 000008f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000900 20 3b 20 62 79 20 27 70 27 20 65 2e 67 2e 20 50 | ; by 'p' e.g. P| 00000910 53 54 41 54 20 31 20 2d 20 63 68 65 63 6b 73 20 |STAT 1 - checks | 00000920 74 68 65 20 73 74 61 74 75 73 0d 0a 20 20 20 20 |the status.. | 00000930 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000940 20 20 20 20 3b 20 6f 66 20 74 68 65 20 70 61 72 | ; of the par| 00000950 61 6c 6c 65 6c 20 70 72 69 6e 74 65 72 20 70 6f |allel printer po| 00000960 72 74 20 4c 50 54 31 2e 20 20 54 68 65 0d 0a 20 |rt LPT1. The.. | 00000970 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000980 20 20 20 20 20 20 20 3b 20 72 65 73 75 6c 74 73 | ; results| 00000990 20 6f 66 20 74 68 65 20 74 65 73 74 20 61 72 65 | of the test are| 000009a0 20 72 65 74 75 72 6e 65 64 20 74 6f 0d 0a 20 20 | returned to.. | 000009b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000009c0 20 20 20 20 20 20 3b 20 74 68 65 20 45 52 52 4f | ; the ERRO| 000009d0 52 4c 45 56 45 4c 2e 0d 0a 20 20 20 20 20 20 20 |RLEVEL... | 000009e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000009f0 20 3b 20 70 3d 28 31 2d 34 29 0d 0a 20 20 20 20 | ; p=(1-4).. | 00000a00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000a10 20 20 20 20 20 20 31 3d 4c 50 54 31 20 5b 50 52 | 1=LPT1 [PR| 00000a20 4e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 |N].. | 00000a30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 3d | 2=| 00000a40 4c 50 54 32 0d 0a 20 20 20 20 20 20 20 20 20 20 |LPT2.. | 00000a50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000a60 33 3d 4c 50 54 33 0d 0a 20 20 20 20 20 20 20 20 |3=LPT3.. | 00000a70 20 20 20 20 20 20 20 20 20 20 34 3d 4c 50 54 34 | 4=LPT4| 00000a80 0d 0a 0d 0a 2d 2d 45 52 52 4f 52 4c 45 56 45 4c |....--ERRORLEVEL| 00000a90 20 72 65 74 75 72 6e 65 64 20 6d 65 61 6e 73 0d | returned means.| 00000aa0 0a 69 66 20 30 20 2d 20 70 72 69 6e 74 65 72 20 |.if 0 - printer | 00000ab0 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 70 6f 72 |connected to por| 00000ac0 74 20 62 75 74 20 4f 46 46 0d 0a 69 66 20 31 20 |t but OFF..if 1 | 00000ad0 2d 20 70 72 69 6e 74 65 72 20 63 6f 6e 6e 65 63 |- printer connec| 00000ae0 74 65 64 20 74 6f 20 70 6f 72 74 20 61 6e 64 20 |ted to port and | 00000af0 4f 4e 0d 0a 69 66 20 32 20 2d 20 73 70 65 63 69 |ON..if 2 - speci| 00000b00 66 69 65 64 20 70 6f 72 74 20 64 6f 65 73 20 6e |fied port does n| 00000b10 6f 74 20 65 78 69 73 74 20 73 6f 20 70 72 69 6e |ot exist so prin| 00000b20 74 65 72 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 69 |ter connection i| 00000b30 6d 70 6f 73 73 69 62 6c 65 0d 0a 69 66 20 33 20 |mpossible..if 3 | 00000b40 2d 20 70 72 69 6e 74 65 72 20 6e 6f 74 20 63 6f |- printer not co| 00000b50 6e 6e 65 63 74 65 64 20 74 6f 20 73 70 65 63 69 |nnected to speci| 00000b60 66 69 65 64 20 70 6f 72 74 0d 0a 0d 0a 0d 0a 20 |fied port...... | 00000b70 20 20 20 20 20 20 20 50 53 54 41 54 20 70 20 73 | PSTAT p s| 00000b80 20 20 20 20 20 20 20 3b 20 70 65 72 66 6f 72 6d | ; perform| 00000b90 73 20 61 20 63 68 65 63 6b 20 6f 66 20 61 20 63 |s a check of a c| 00000ba0 65 72 74 61 69 6e 20 70 6f 73 73 69 62 6c 65 0d |ertain possible.| 00000bb0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 00000bc0 20 20 20 20 20 20 20 20 20 3b 20 73 74 61 74 65 | ; state| 00000bd0 20 6f 66 20 61 20 70 72 69 6e 74 65 72 20 63 6f | of a printer co| 00000be0 6e 6e 65 63 74 65 64 20 74 6f 20 70 6f 72 74 20 |nnected to port | 00000bf0 27 70 27 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 |'p'... | 00000c00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; | 00000c10 27 70 27 20 69 73 20 65 69 74 68 65 72 20 31 2c |'p' is either 1,| 00000c20 32 2c 33 20 6f 72 20 34 20 73 70 65 63 69 66 79 |2,3 or 4 specify| 00000c30 69 6e 67 20 4c 50 54 31 2c 0d 0a 20 20 20 20 20 |ing LPT1,.. | 00000c40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000c50 20 20 20 3b 20 4c 50 54 32 2c 20 4c 50 54 33 20 | ; LPT2, LPT3 | 00000c60 65 74 63 20 77 68 69 6c 65 20 27 73 27 20 73 70 |etc while 's' sp| 00000c70 65 63 69 66 69 65 73 20 74 68 65 20 73 74 61 74 |ecifies the stat| 00000c80 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 |e.. | 00000c90 20 20 20 20 20 20 20 20 20 20 20 3b 20 74 6f 20 | ; to | 00000ca0 63 68 65 63 6b 20 69 66 20 69 74 27 73 20 73 65 |check if it's se| 00000cb0 74 20 65 2e 67 2e 20 50 53 54 41 54 20 31 20 34 |t e.g. PSTAT 1 4| 00000cc0 20 2d 20 6c 6f 6f 6b 73 0d 0a 20 20 20 20 20 20 | - looks.. | 00000cd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000ce0 20 20 3b 20 61 74 20 61 20 70 72 69 6e 74 65 72 | ; at a printer| 00000cf0 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 70 6f | connected to po| 00000d00 72 74 20 4c 50 54 31 20 74 6f 20 73 65 65 0d 0a |rt LPT1 to see..| 00000d10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000d20 20 20 20 20 20 20 20 20 3b 20 69 66 20 69 74 20 | ; if it | 00000d30 69 73 20 27 6f 75 74 20 6f 66 20 70 61 70 65 72 |is 'out of paper| 00000d40 27 2e 20 20 49 66 20 74 68 65 20 70 72 69 6e 74 |'. If the print| 00000d50 65 72 20 69 73 0d 0a 20 20 20 20 20 20 20 20 20 |er is.. | 00000d60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | ;| 00000d70 20 6f 75 74 20 6f 66 20 70 61 70 65 72 20 74 68 | out of paper th| 00000d80 65 20 45 52 52 4f 52 4c 45 56 45 4c 20 72 65 74 |e ERRORLEVEL ret| 00000d90 75 72 6e 73 20 31 20 66 6f 72 0d 0a 20 20 20 20 |urns 1 for.. | 00000da0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000db0 20 20 20 20 3b 20 54 52 55 45 20 6f 74 68 65 72 | ; TRUE other| 00000dc0 77 69 73 65 20 30 20 66 6f 72 20 4e 4f 54 20 54 |wise 0 for NOT T| 00000dd0 52 55 45 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 |RUE... | 00000de0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; | 00000df0 70 3d 28 31 2d 34 29 20 20 73 3d 28 31 2d 36 29 |p=(1-4) s=(1-6)| 00000e00 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |.. | 00000e10 20 20 20 20 20 20 20 20 20 20 20 20 31 3d 4c 50 | 1=LP| 00000e20 54 31 20 20 20 31 3d 44 65 76 69 63 65 20 74 69 |T1 1=Device ti| 00000e30 6d 65 20 6f 75 74 3f 0d 0a 20 20 20 20 20 20 20 |me out?.. | 00000e40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000e50 20 20 20 32 3d 4c 50 54 32 20 20 20 32 3d 49 2f | 2=LPT2 2=I/| 00000e60 4f 20 65 72 72 6f 72 3f 0d 0a 20 20 20 20 20 20 |O error?.. | 00000e70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000e80 20 20 20 20 33 3d 4c 50 54 33 20 20 20 33 3d 53 | 3=LPT3 3=S| 00000e90 65 6c 65 63 74 65 64 3f 0d 0a 20 20 20 20 20 20 |elected?.. | 00000ea0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000eb0 20 20 20 20 34 3d 4c 50 54 34 20 20 20 34 3d 4f | 4=LPT4 4=O| 00000ec0 75 74 20 6f 66 20 50 61 70 65 72 3f 0d 0a 20 20 |ut of Paper?.. | 00000ed0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 00000ef0 20 35 3d 41 63 6b 6e 6f 77 6c 65 64 67 65 3f 0d | 5=Acknowledge?.| 00000f00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 00000f10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000f20 20 20 20 20 36 3d 4e 6f 74 20 42 75 73 79 3f 0d | 6=Not Busy?.| 00000f30 0a 0d 0a 2d 2d 45 52 52 4f 52 4c 45 56 45 4c 20 |...--ERRORLEVEL | 00000f40 72 65 74 75 72 6e 65 64 20 6d 65 61 6e 73 0d 0a |returned means..| 00000f50 69 66 20 30 20 2d 20 73 74 61 74 75 73 20 69 73 |if 0 - status is| 00000f60 20 4e 4f 54 20 54 52 55 45 20 28 65 2e 67 2e 20 | NOT TRUE (e.g. | 00000f70 66 6f 72 20 73 3d 32 2c 20 6d 65 61 6e 73 20 4e |for s=2, means N| 00000f80 4f 20 49 2f 4f 20 65 72 72 6f 72 29 0d 0a 69 66 |O I/O error)..if| 00000f90 20 31 20 2d 20 73 74 61 74 75 73 20 69 73 20 54 | 1 - status is T| 00000fa0 52 55 45 20 20 20 20 20 28 65 2e 67 2e 20 66 6f |RUE (e.g. fo| 00000fb0 72 20 73 3d 32 2c 20 6d 65 61 6e 73 20 59 45 53 |r s=2, means YES| 00000fc0 20 49 2f 4f 20 65 72 72 6f 72 29 0d 0a 0d 0a 0d | I/O error).....| 00000fd0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 00000fe0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000ff0 20 55 73 69 6e 67 20 50 54 45 53 54 2e 42 41 54 | Using PTEST.BAT| 00001000 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |.. | 00001010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00001020 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e | ~~~~~~~~~~~~~~~| 00001030 7e 7e 0d 0a 0d 0a 20 20 20 50 54 45 53 54 2e 42 |~~.... PTEST.B| 00001040 41 54 20 20 69 73 20 20 61 20 20 62 61 74 63 68 |AT is a batch| 00001050 20 20 66 69 6c 65 20 70 72 6f 67 72 61 6d 20 20 | file program | 00001060 77 68 69 63 68 20 20 73 68 6f 77 73 20 20 6f 6e |which shows on| 00001070 65 20 20 6f 66 20 20 74 68 65 0d 0a 20 20 20 61 |e of the.. a| 00001080 70 70 6c 69 63 61 74 69 6f 6e 73 20 20 6f 66 20 |pplications of | 00001090 20 77 68 69 63 68 20 50 53 54 41 54 20 63 61 6e | which PSTAT can| 000010a0 20 62 65 20 75 73 65 64 2e 20 20 49 74 20 72 65 | be used. It re| 000010b0 70 6f 72 74 73 20 20 62 61 63 6b 20 20 74 68 65 |ports back the| 000010c0 0d 0a 20 20 20 73 74 61 74 75 73 20 6f 66 20 74 |.. status of t| 000010d0 68 65 20 34 20 70 6f 73 73 69 62 6c 65 20 70 61 |he 4 possible pa| 000010e0 72 61 6c 6c 65 6c 20 70 72 69 6e 74 65 72 20 70 |rallel printer p| 000010f0 6f 72 74 73 20 61 6e 64 20 74 68 65 20 73 74 61 |orts and the sta| 00001100 74 75 73 20 6f 66 0d 0a 20 20 20 74 68 65 20 70 |tus of.. the p| 00001110 72 69 6e 74 65 72 2e 0d 0a 0d 0a 20 20 20 54 6f |rinter..... To| 00001120 20 72 75 6e 20 50 54 45 53 54 20 75 73 65 3a 2d | run PTEST use:-| 00001130 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 50 54 |.... PT| 00001140 45 53 54 20 3c 52 65 74 75 72 6e 3e 0d 0a 0d 0a |EST <Return>....| 00001150 0d 0a 20 20 20 50 54 45 53 54 20 6d 61 79 20 62 |.. PTEST may b| 00001160 65 20 73 6c 6f 77 20 64 65 70 65 6e 64 69 6e 67 |e slow depending| 00001170 20 6f 6e 20 74 68 65 20 61 72 65 61 20 6f 66 20 | on the area of | 00001180 74 68 65 20 66 6c 6f 70 70 79 20 64 69 73 6b 20 |the floppy disk | 00001190 69 74 20 20 69 73 0d 0a 20 20 20 70 6f 73 69 74 |it is.. posit| 000011a0 69 6f 6e 65 64 20 62 65 63 61 75 73 65 20 69 74 |ioned because it| 000011b0 20 6e 65 65 64 73 20 74 6f 20 61 63 63 65 73 73 | needs to access| 000011c0 20 50 53 54 41 54 2e 45 58 45 20 61 20 66 65 77 | PSTAT.EXE a few| 000011d0 20 74 69 6d 65 73 2e 20 20 20 49 6e 0d 0a 20 20 | times. In.. | 000011e0 20 79 6f 75 72 20 20 6f 77 6e 20 70 72 6f 67 72 | your own progr| 000011f0 61 6d 73 20 79 6f 75 20 6d 61 79 20 6f 6e 6c 79 |ams you may only| 00001200 20 61 63 63 65 73 73 20 50 53 54 41 54 2e 45 58 | access PSTAT.EX| 00001210 45 20 61 20 66 65 77 20 20 74 69 6d 65 73 20 20 |E a few times | 00001220 73 6f 0d 0a 20 20 20 74 68 69 73 20 20 73 68 6f |so.. this sho| 00001230 75 6c 64 20 6e 6f 74 20 62 65 20 61 20 70 72 6f |uld not be a pro| 00001240 62 6c 65 6d 2e 20 20 49 66 20 79 6f 75 72 20 62 |blem. If your b| 00001250 61 74 63 68 20 66 69 6c 65 73 20 20 77 69 6c 6c |atch files will| 00001260 20 20 61 63 63 65 73 73 0d 0a 20 20 20 50 53 54 | access.. PST| 00001270 41 54 2e 45 58 45 20 61 20 67 72 65 61 74 20 64 |AT.EXE a great d| 00001280 65 61 6c 20 74 68 65 6e 20 79 6f 75 20 73 68 6f |eal then you sho| 00001290 75 6c 64 20 65 69 74 68 65 72 20 70 75 74 20 50 |uld either put P| 000012a0 53 54 41 54 2e 45 58 45 20 20 6f 6e 74 6f 0d 0a |STAT.EXE onto..| 000012b0 20 20 20 61 20 27 72 61 6d 64 69 73 6b 27 20 6f | a 'ramdisk' o| 000012c0 72 20 79 6f 75 72 20 68 61 72 64 20 64 69 73 6b |r your hard disk| 000012d0 20 74 6f 20 6f 66 66 65 72 20 62 65 73 74 20 65 | to offer best e| 000012e0 66 66 69 63 69 65 6e 63 79 2e 0d 0a 0d 0a 0d 0a |fficiency.......| 000012f0 20 20 20 49 6e 20 79 6f 75 72 20 6f 77 6e 20 70 | In your own p| 00001300 72 6f 67 72 61 6d 73 20 79 6f 75 20 6d 61 79 20 |rograms you may | 00001310 6f 6e 6c 79 20 6e 65 65 64 20 74 6f 20 63 68 65 |only need to che| 00001320 63 6b 20 69 66 20 74 68 65 20 70 72 69 6e 74 65 |ck if the printe| 00001330 72 20 69 73 0d 0a 20 20 20 27 6f 6e 6c 69 6e 65 |r is.. 'online| 00001340 27 20 20 6f 72 20 6a 75 73 74 20 63 68 65 63 6b |' or just check| 00001350 20 69 66 20 74 68 65 72 65 20 69 73 20 65 6e 6f | if there is eno| 00001360 75 67 68 20 70 61 70 65 72 20 69 6e 20 20 74 68 |ugh paper in th| 00001370 65 20 20 70 72 69 6e 74 65 72 0d 0a 20 20 20 61 |e printer.. a| 00001380 6e 64 20 73 6f 20 61 73 6b 20 74 68 65 20 75 73 |nd so ask the us| 00001390 65 72 20 74 6f 20 69 6e 73 65 72 74 20 73 6f 6d |er to insert som| 000013a0 65 20 6d 6f 72 65 20 70 61 70 65 72 2e 20 20 59 |e more paper. Y| 000013b0 6f 75 20 63 61 6e 20 63 68 65 63 6b 20 20 61 73 |ou can check as| 000013c0 0d 0a 20 20 20 6d 61 6e 79 20 6f 72 20 61 73 20 |.. many or as | 000013d0 66 65 77 20 73 74 61 74 65 73 20 61 73 20 79 6f |few states as yo| 000013e0 75 20 6c 69 6b 65 2e 0d 0a 0d 0a 0d 0a 20 20 20 |u like....... | 000013f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00001400 20 20 20 20 20 20 20 20 55 73 69 6e 67 20 74 68 | Using th| 00001410 65 20 45 52 52 4f 52 4c 45 56 45 4c 20 76 61 6c |e ERRORLEVEL val| 00001420 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 |ue.. | 00001430 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7e 7e | ~~| 00001440 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~~~~~~~~~| 00001450 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0d 0a 0d 0a 20 20 |~~~~~~~~~~.... | 00001460 20 50 53 54 41 54 20 72 65 74 75 72 6e 73 20 61 | PSTAT returns a| 00001470 6e 20 45 52 52 4f 52 4c 45 56 45 4c 20 76 61 6c |n ERRORLEVEL val| 00001480 75 65 20 61 6e 64 20 74 68 69 73 20 69 6e 20 74 |ue and this in t| 00001490 75 72 6e 20 63 61 6e 20 62 65 20 72 65 61 64 20 |urn can be read | 000014a0 62 79 0d 0a 20 20 20 62 61 74 63 68 20 66 69 6c |by.. batch fil| 000014b0 65 73 3a 2d 0d 0a 0d 0a 20 20 20 62 61 74 63 68 |es:-.... batch| 000014c0 20 66 69 6c 65 20 65 78 74 72 61 63 74 3a 2d 0d | file extract:-.| 000014d0 0a 0d 0a 0d 0a 50 53 54 41 54 20 32 20 20 20 20 |.....PSTAT 2 | 000014e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000014f0 20 20 3b 20 62 61 74 63 68 20 66 69 6c 65 20 72 | ; batch file r| 00001500 75 6e 73 20 50 53 54 41 54 20 74 6f 20 63 68 65 |uns PSTAT to che| 00001510 63 6b 20 70 6f 72 74 20 4c 50 54 32 20 28 32 29 |ck port LPT2 (2)| 00001520 0d 0a 49 46 20 45 52 52 4f 52 4c 45 56 45 4c 3d |..IF ERRORLEVEL=| 00001530 3d 33 20 47 4f 54 4f 20 4e 4f 54 43 4f 4e 20 3b |=3 GOTO NOTCON ;| 00001540 20 69 66 20 74 68 65 20 45 52 52 4f 52 4c 45 56 | if the ERRORLEV| 00001550 45 4c 20 72 65 74 75 72 6e 20 76 61 6c 75 65 20 |EL return value | 00001560 77 61 73 20 33 0d 0a 49 46 20 45 52 52 4f 52 4c |was 3..IF ERRORL| 00001570 45 56 45 4c 3d 3d 32 2e 2e 2e 2e 2e 2e 20 20 20 |EVEL==2...... | 00001580 20 20 20 20 3b 20 74 68 65 6e 20 69 74 20 6d 65 | ; then it me| 00001590 61 6e 73 20 74 68 61 74 20 6e 6f 20 70 72 69 6e |ans that no prin| 000015a0 74 65 72 20 77 61 73 20 63 6f 6e 6e 65 63 74 65 |ter was connecte| 000015b0 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 |d.. | 000015c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000015d0 3b 20 61 6e 64 20 73 6f 20 61 20 6a 75 6d 70 20 |; and so a jump | 000015e0 77 6f 75 6c 64 20 62 65 20 6d 61 64 65 20 74 6f |would be made to| 000015f0 20 4e 4f 54 43 4f 4e 20 74 6f 0d 0a 20 20 20 20 | NOTCON to.. | 00001600 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00001610 20 20 20 20 20 20 20 20 20 3b 20 70 72 6f 62 61 | ; proba| 00001620 62 6c 79 20 61 73 6b 20 74 68 65 20 75 73 65 72 |bly ask the user| 00001630 20 74 6f 20 63 6f 6e 6e 65 63 74 20 61 20 70 72 | to connect a pr| 00001640 69 6e 74 65 72 0d 0a 20 20 20 20 20 20 20 20 20 |inter.. | 00001650 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00001660 20 20 20 20 3b 20 74 6f 20 70 6f 72 74 20 4c 50 | ; to port LP| 00001670 54 32 20 28 32 29 2e 0d 0a 0d 0a 20 20 20 54 68 |T2 (2)..... Th| 00001680 65 20 6d 65 74 68 6f 64 20 6f 66 20 63 68 65 63 |e method of chec| 00001690 6b 69 6e 67 20 74 68 65 20 70 72 69 6e 74 65 72 |king the printer| 000016a0 20 69 73 20 74 6f 20 72 75 6e 20 50 53 54 41 54 | is to run PSTAT| 000016b0 20 61 6e 64 20 74 68 65 6e 20 75 73 69 6e 67 0d | and then using.| 000016c0 0a 20 20 20 45 52 52 4f 52 4c 45 56 45 4c 20 74 |. ERRORLEVEL t| 000016d0 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 |o determine the | 000016e0 72 65 73 75 6c 74 20 61 6e 64 20 61 63 74 69 6e |result and actin| 000016f0 67 20 61 63 63 6f 72 64 69 6e 67 6c 79 2e 0d 0a |g accordingly...| 00001700 0d 0a 20 20 20 59 6f 75 20 64 6f 6e 27 74 20 68 |.. You don't h| 00001710 61 76 65 20 61 6e 79 20 65 78 63 75 73 65 20 66 |ave any excuse f| 00001720 6f 72 20 77 72 69 74 69 6e 67 20 74 68 6f 73 65 |or writing those| 00001730 20 62 61 74 63 68 20 66 69 6c 65 73 20 6e 6f 77 | batch files now| 00001740 21 2c 0d 0a 0d 0a 20 20 20 45 6e 6a 6f 79 21 0d |!,.... Enjoy!.| 00001750 0a |.| 00001751