Testing Printer Status
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 11 APR 1989 | 1.1X | INTERMEDIATE | PDISK, PRNSTAT, PRINTERS |
When writing programs that will direct output to a printer, it is desirable to know whether or not the printer is ready. Until Version 1.1 of Advanced Revelation, this was a difficult task from within a program. There is now a system subroutine, PRNSTAT, that will return the printer's status.
PRNSTAT takes one argument in which the status of the printer is returned. PRNSTAT can be used as follows:
DECLARE SUBROUTINE PRNSTAT PRINTER.STATUS = '' LOOP PRNSTAT(PRINTER.STATUS) IF PRINTER.STATUS THEN * there was a problem * error handling goes here END WHILE PRINTER.STATUS REPEAT
PRINTER.STATUS will have one of four values:
Status | Meaning |
---|---|
0 | Printer ok |
1 | Printer not selected (or not connected) |
2 | Printer out of paper (or not connected) |
3 | I/O or timeout error |
Note: In order to implement PRNSTAT, changes to the AREV.EXE were required. PRNSTAT will not work in releases prior to 1.1. Further changes to AREV.EXE are required to make PRNSTAT recognize PDISK. As of Version 1.13, PRNSTAT will always look for a physical printer, even if the output has been redirected to a print file via PDISK.