Announcement

Collapse
No announcement yet.

Setting Printer Timeout

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting Printer Timeout

    What do I need to change on this to make the printer time out
    shorter (from 45 seconds to 10 seconds)

    PErrorTrap:
    DEF SEG = &H40
    PRN& = PEEK(9) AND 255
    PRN& = PRN& * 256 + (PEEK(8) AND 255) + 1
    DO
    IF t% = INP(PRN&): E% = 16
    IF (t% AND 16) = 16 THEN PRINT "Printer Online": E% = E% XOR 16
    IF (t% AND 32) = 32 THEN PRINT "Out of Paper": E% = E% OR 32
    IF (t% AND 128) = 0 THEN PRINT "Printer Busy": E% = E% OR 128
    IF E% > 0 THEN
    PRINT "Fix Printer and try again."
    WHILE INKEY$ <> "": WEND: WHILE INKEY$ = "": WEND
    END IF
    LOOP WHILE (E% > 0) AND (INKEY$ <> CHR$(27))
    '_|_|_| end

  • #2
    Here is the sub I use - I save the original value to reset it later on. To cut the retries down to 10 sec, set NewTries% = 4

    If you are working with a networked printer, or a "virtual" port like LPT4 or above (under Windows), then there are other solutions such as editing entries in SYSTEM.INI.

    Code:
    sub SetPrinterTimeout(byval Port?, SaveTries%, NewTries%) local public
      local RetryAddr%
      ' default for SaveTries% = 20 as set by DOS
      if Port? < 1 or Port? > 3 then exit sub
      RetryAddr% = &H477 + Port?              ' LPTNo = 1 for LPT1, 2 for LPT2, etc
      def seg = 0                             ' For the peeks and pokes that follow
      SaveTries% = peek(RetryAddr%)           ' Save the current setting
      poke RetryAddr%, NewTries%              ' Set to 1-255 retries, 0 = infinite
      def seg
    end sub
    ' **************************************************************************

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    Working...
    X