home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / PRINTOK.PRG < prev    next >
Encoding:
Text File  |  1991-06-27  |  1.5 KB  |  55 lines

  1. /*
  2.     Program: PRINTOK()
  3.     System: GRUMPFISH LIBRARY
  4.     Author: Greg Lief
  5.     Copyright (c) 1988, Greg Lief
  6.     Clipper 5.x Version
  7.     Compile instructions: clipper printok /n/w/a
  8.     Special thanks to Robert Scher and Matt Amis for their input
  9.     Ensures that printer is on-line before printing
  10. */
  11.  
  12. //───── begin preprocessor directives
  13.  
  14. #include "grump.ch"
  15. #include "inkey.ch"
  16.  
  17. //───── end preprocessor directives
  18.  
  19. function printok(sez)
  20. local ret_val := .t., oldcolor, oldscrn, oldconsole
  21. sez := (sez == NIL)    // if no parameter passed, assume use of @...says
  22. if ! isprinter()
  23.    oldcolor := colorset(C_ERRORMESSAGE)
  24.    oldscrn := ShadowBox(09, 11, 14, 67, 3, 'Printer Error')
  25.    @ 10, 13 ssay 'Common problems include: out of paper, paper jammed,'
  26.    @ 11, 13 ssay 'off-line, printer unplugged, cable loose or unplugged'
  27.    @ 12, 13 ssay 'Please check your printer and press any key to resume'
  28.    @ 13, 13 ssay '(or press the Esc key to abort this print operation)'
  29.    oldconsole := set(_SET_CONSOLE, .F.)
  30.    do while ! isprinter() .and. lastkey() != K_ESC
  31.       tone(MUSIC_ALERT, 1)
  32.       tone(MUSIC_ALERT, 1)
  33.       ginkey(0)
  34.    enddo
  35.    set(_SET_CONSOLE, oldconsole)
  36.    ByeByeBox(oldscrn)
  37.    setcolor(oldcolor)
  38.    if lastkey() == K_ESC
  39.       ret_val := .f.
  40.    endif
  41. endif
  42. if ret_val
  43.    if sez
  44.       set device to print
  45.    else
  46.       set print on
  47.    endif
  48. endif
  49. return(ret_val)
  50.  
  51. * end function PrintOK()
  52. *--------------------------------------------------------------------*
  53.  
  54. * eof printok.prg
  55.