SP_ISPRN

ISPRN() Detects printer ready (or not) on LPT1, 2 or 3

 Returns
 <lReady> => printer ready

 Syntax
 ISPRN(nPort)

 Description
 <nPort> is either 0, 1 or 2, corresponding to LPT1,
 LPT2 or LPT3

 Examples
  if ISPRN(0)
    MSG("LPT1 is ready")
  elseif ISPRN(1)
    MSG("LPT2 is ready")
  elseif ISPRN(2)
    MSG("LPT3 is ready")
  endif

 Warnings:
 Will not ALWAYS work reliably on a network
 (redirected) printer

 Source: ISPRN.ASM

 

FT_ISPRINT

FT_ISPRINT()
 Check printer status
------------------------------------------------------------------------------

 Syntax

     FT_ISPRINT( [ <cDevice> ] ) -> lResult

 Arguments

    <cDevice> is optional and is the device to test (LPT2, COM1, etc.).
    If omitted, the function will default to the PRN device.

 Returns

    .T.  if device is ready for output.
    .F.  if one of the following conditions occurs:
         1)  The device is not ready.
         2)  The device does not exist.
         3)  DOS couldn't open the device for some reason
             (such as no file handles available).

 Description

    The Clipper IsPrinter() function is somewhat limited because it only
    works with LPT1.  Furthermore, it talks directly to the hardware, so
    if you have redirected LPT1 via the DOS MODE command, the IsPrinter()
    function will return erroneous results.

    This function offers a better alternative.  Instead of talking to the
    hardware, it issues a DOS call that checks to see if the device is
    ready or not.  That gives DOS an opportunity to deal with any
    redirections, and since you pass the device name as a parameter, you
    can test any device, not just LPT1 (note that the function defaults
    to PRN if you fail to pass a valid parameter).

    The function also temporarily traps the DOS critical error handler so
    you don't get any nasty error messages if the device isn't ready.  It
    restores the old critical error handler before exiting.

    Note that although this function is mainly designed for testing
    printers, you can also check to see if a drive is ready.  Since DOS
    thinks the NUL device exists on every drive, you can pass a drive
    letter followed by NUL as a parameter.  If DOS is able to open the
    NUL device, then the drive is ready, otherwise the door is open or
    something else is wrong.

    The source code is written to adhere to Turbo Assembler's IDEAL mode.
    To use another assembler, you will need to rearrange the PROC and
    SEGMENT directives, and also the ENDP and ENDS directives (a very
    minor task).

 Examples

    IF ! FT_ISPRINT()
       Qout( "PRN is not ready!" )
    ENDIF

    IF ! FT_ISPRINT( "COM2" )
       Qout( "Check the device on COM2.  Something is wrong." )
    ENDIF

    IF ! FT_ISPRINT( "A:\NUL" )
       Qout( "Oops, better check drive A!" )
    ENDIF

 Source: ISPRINT.ASM

 Author: Ted Means

 

C5_ISPRINTER

 ISPRINTER()
 Determine whether LPT1 is ready
------------------------------------------------------------------------------
 Syntax

     ISPRINTER() --> lReady

 Returns

     ISPRINTER() returns true (.T.) if LPT1 is ready; otherwise, it returns
     false (.F.).

 Description

     ISPRINTER() is a printer function that determines whether the parallel
     port (LPT1) is online and ready to print.  ISPRINTER() is
     hardware-dependent and, therefore, only works on IBM BIOS compatible
     systems.

     You can check ISPRINTER() to make sure the printer is ready before you
     begin a print operation; however, if an error occurs during the print
     operation, a runtime error is generated.

 Examples

     .  This example tests the parallel port for readiness with up to
        25 retries.  If the parallel port is ready, the printer operation
        begins:

        LOCAL nCount := 0, nTimes := 25, lReady
        //
        DO WHILE nCount++ <= nTimes .AND. !(lReady := ;
              ISPRINTER())
        ENDDO
        //
        IF lReady
           REPORT FORM Sales TO PRINTER
        ELSE
           ? "Printer not ready..."
           BREAK
        ENDIF

 Files   Library is EXTEND.LIB, source file is SOURCE\SAMPLE\EXAMPLEA.ASM.

See Also: SET DEVICE SET PRINTER



CL5 Printing Commands, Statements and Funtions

?/?? :

Display or print one or more values to the console or printer

? | ?? [<exp list>]

@…SAY :

Display or print data at a specified screen or printer row and column

@ <nRow>, <nCol>
   [SAY <exp>
   [PICTURE <cSayPicture>]
   [COLOR <cColorString>]]
   [GET <idVar>
   [PICTURE <cGetPicture>]
   [COLOR <cColorString>]]
   [WHEN <lPreExpression>]
   [RANGE* <dnLower>, <dnUpper>] |
   [VALID <lPostExpression>]

DEVPOS() :

Move the cursor or printhead to a new position depending on the current device

DEVPOS(<nRow>, <nCol>) --> NIL

DISPLAY :

Display or print records to the console or printer

DISPLAY <exp list>
   [TO PRINTER] [TO FILE <xcFile>]
   [<scope>] [WHILE <lCondition>]
   [FOR <lCondition>] [OFF]

EJECT :

Advance the print head to top of form

EJECT

ISPRINTER() :

Determine whether the LPT1 is ready

ISPRINTER() --> lReady

LABEL FORM :

Display or print labels to the console or printer

LABEL FORM <xcLabel>
   [TO PRINTER] [TO FILE <xcFile>] [NOCONSOLE]
   [<scope>] [WHILE <lCondition>] [FOR <lCondition>]
   [SAMPLE]

LIST :

List or print records to the console or printer

LIST <exp list>
   [TO PRINTER] [TO FILE <xcFile>]
   [<scope>] [WHILE <lCondition>]
   [FOR <lCondition>] [OFF]

OUTSTD() :

Write a list of values to the standard output device

OUTSTD(<exp list>) --> NIL

PCOL() :

Return the current column position of the printhead

PCOL() --> nColumn

PROW() :

Return the current row position of the printhead

PROW() --> nRow

QOUT() :

Display or print a list of expressions to the console or printer

QOUT( [ <exp list> ] ) --> NIL
QQOUT( [ <exp list> ] ) --> NIL

REPORT FORM :

Display or print a report to the console or printer

REPORT FORM <xcReport>
   [TO PRINTER] [TO FILE <xcFile>] [NOCONSOLE]
   [<scope>] [WHILE <lCondition>] [FOR <lCondition>]
   [PLAIN | HEADING <cHeading>] [NOEJECT] [SUMMARY]

SET MARGIN :

Set the page offset for all printed pages

SET MARGIN TO [<nPageOffset>]

SET PRINTER :

Toggle echo of console output to the printer or set the destination of printed output

SET PRINTER on | OFF | <xlToggle>
SET PRINTER TO [<xcDevice> | <xcFile> [ADDITIVE]]

SETPRC() :

Set PROW() and PCOL() values

SETPRC(<nRow>, <nCol>) --> NIL

TYPE :

Display or print the contents of a text file

TYPE <xcFile> [TO PRINTER] [TO FILE <xcOutFile>]