


                                 PRINTERR.TXT


                                  WRITTEN BY 

                               CHARLES W. PALMER
                             LEONARDTOWN, MD 20650

                                (301) 475-9212



RELEASE:      1.0  May 14, 1987


NOTICE:       This product is released to the Public Domain for anyone's use. 
              Feel free to update the programs and/or the documentation if you 
              find a better way to do what I tried to accomplish and/or 
              enhanced features that you might think should be included.



BACKROUND:    The following set of programs were developed to be used with the 
              Quicksilver compiler manufactured by Wordtech Systems.  When 
              using Quicksilver, if the printer is off-line and your program 
              has the on-error feature turned off, Quicksilver blows up and 
              kicks you out of the application.  This set of programs checks 
              the printer for its off/on-line status before attempting to print 
              while running your report program.  If the printer is on-line the
              program continues on its way.  If the printer is off-line or
              turned off, the program gives you the option of readying the 
              printer or quitting out of the program and return to the calling 
              program.  This was all written in dBASE III Plus and compiled 
              using Quicksilver version 1.0D.  I did this because I try to keep 
              as much programming within dBASE without having to resort to 
              Assember routines.  So, this routine may not be the greatest but 
              it suits my needs and you may find it is what you need without 
              having to call routines outside of dBASE.




DESCRIPTION:  There are two separate programs and one piece of code (that 
              needs to be included in your report program) needed to run this 
              printer routine.  The first item listed is the piece of code to 
              be inserted within you report program.  I have included a small 
              example of a report program showing where the code needs to be 
              included.  This section is commented out of the report program 
              using the Quicksilver *\ symbol so I can still use this report 
              in dBASE if I have to.  The next two programs are the actual 
              printer check routines.











------------------------------------------------------------------------------


* Program..: TEST.PRG
* Author...: CHARLES W. PALMER
* Date.....: 05/14/87


*\  *************************************
*\  *   START PRINTER STATUS ROUTINE    *
*\  *************************************
*\
*\  CLEAR
*\  PRINTCHK = SPACE(1)
*\  CHECK = SPACE(1)
*\  CHECK1 = SPACE(1)
*\  ANS = SPACE(1)
*\  BYE = SPACE(1)
*\  PRINTCHK = SPACE(1)
*\  *********************************************************
*\  *   SAVE ALL VARIABLES TO THE MEMORY VARIABLE CHECKON   *
*\  *********************************************************
*\  SAVE TO CHECKON
*\  SET COLOR TO B+*/N
*\  @ 10,30 SAY "CHECKING PRINTER STATUS"
*\  ***********************
*\  *   CALL PRINTON.PRG  *
*\  ***********************
*\  DO PRINTON
*\  RESTORE FROM CHECKON
*\  IF PRINTCHK = "X"
*\     CLEAR ALL
*\     RETURN
*\  ENDIF
*\  DO COL-OFF
*\  ON ERROR
*\  *******************************
*\  * END PRINTER STATUS ROUTINE  *
*\  *******************************

CLEAR
CLEAR ALL
USE TEST INDEX TEST

@ 10,30 SAY "PLEASE WAIT..."
SET COLOR TO R+*/N
@ 12,30 SAY "INDEXING......"
INDEX ON VS_GROUP+PROJECT+LEAD TO PROJASSI

SET MARGIN TO 1
STORE 1 TO pagenum
STORE 254 TO line
STORE "TEST OF REPORT" TO pagehdg
STORE (80-LEN(pagehdg))/2 TO col_hdg
                .
                .
                .
    THE REPORT IS CONTANED HERE
                .
                .
                .
* EOF:  TEST.PRG






------------------------------------------------------------------------------



* PROGRAM..:  PRINTERR.PRG
* AUTHOR...:  CHARLES W. PALMER 
* DATE.....:  05/14/87


*********************************
*  QUICKSILVER ERROR CODE - 42  *
*********************************
IF ERROR() = 42

        BYE = SPACE(1)
        ANS = SPACE(1)
        PRINTCHK = SPACE(1)
        SET COLOR TO R+*/N
        ? CHR(7)
        @ 21,0 CLEAR TO 23,79
        @ 21,0 SAY "PRINTER NOT RESPONDING........" 
        DO COL-OFF
        @ 23,0 SAY "Ready your printer and press RETURN to continue or 'Q' "+;
                   "to quit:" GET ANS PICTURE "!"
        READ
 
        IF ANS = "Q"
           STORE "X" TO PRINTCHK
        ELSE
           PRINTCHK = SPACE(1)
        ENDIF
        STORE "X" TO CHECK1
        STORE "X" TO BYE
        @ 21,0 CLEAR TO 23,79
 
ELSE
 
        STORE " " TO BYE

ENDIF   

SAVE TO CHECKON

RETURN

* EOF:  PRINTERR.PRG



















------------------------------------------------------------------------------



* PROGRAM....:  PRINTON.PRG
* AUTHOR.....:  CHARLES W. PALMER 
* DATE.......:  05/14/87

RESTORE FROM CHECKON
ON ERROR DO PRINTERR
DO WHILE CHECK <> "X"     
   SET PRINT ON
   RESTORE FROM CHECKON
   IF BYE = " "
      EXIT
   ENDIF
   IF PRINTCHK = "X"
      EXIT
   ENDIF
   IF CHECK1 = "X"
      CHECK = SPACE(1)
      CHECK1 = "X"
      ANS = SPACE(1)
      BYE = " "
      PRINTCHK = SPACE(1)
      SAVE TO CHECKON
      LOOP
   ENDIF
   STORE "X" TO CHECK
ENDDO

IF PRINTCHK <> "X"
   SET PRINT OFF
ENDIF

RETURN

* EOF: PRINTON.PRG
                                                     


------------------------------------------------------------------------------



                    P.S. - GOOD LUCK AND HAPPY PROGRAMMING

