Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_psget( <cprintserver>, <nprinter>, http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_PSGET( <cPrintServer>, <nPrinter>, 
         <cAttribute1> | <nAttribute1> [, @<Memvar1>
      [, <cAttribute2> | <nAttribute2>, @<Memvar2>... ] ] )
-- or --
N_PSGET( <cPrintServer>, <nPrinter>,
         <aAttribute>, <aSetting>   )


Parameters

<cPrintServer>
Name of the print server.

NetLib will remember the argument to <cPrintServer> specified in the 
last call to one of the N_PS* functions. You can then pass NIL as the 
argument, and NetLib will assume you mean the same print server as 
before. If no print server has yet been specified, NIL will represent 
the first or only print server defined in the system. Thus this 
sequence is permissible:

N_PSGET('PSERVER0', 0, ...)
N_PSSET( , 0, ...)


<nPrinter>
Printer number. Numbering starts with zero. The first network printer 
is 0.

<cAttribute> -- or -- <nAttribute>
Attribute to read. May be passed as a text string or as a numeric 
value. See the table below for a list of printer attributes.

@<Memvar>
Optional memory variable to receive the information.

<aAttribute>
An array containing the names or numbers of the attributes you wish to 
read. This is an alternative to passing a series of attribute/ memory 
variable pairs.

<aSetting>
An array to receive information for the attributes listed in the 
corresponding array <aAttribute>.

The number of elements in <aSetting> must be equal to or greater than 
the number of elements in <aAttribute>, or trailing values will be 
lost. For example, if <aAttribute> has eight elements and <aSetting> 
has only six, then attributes seven and eight will not be stored in the 
receiving array.

Clipper 5.x  If <aSetting> is initialized to zero elements, the 
function will automatically set it to the correct resize.


Returns

The value of the last or only attibute in the list. It is possible to 
call the function with only three Parameters, omitting @<Memvar>, 
and obtain the information as the return value.


Description

Stores information about the specified printer into memory variables. 
You can include as many attribute/memory variable pairs as needed. 
Reading several attributes in a single call is more efficient than 
repeated calls to N_PSGET().

Printer attributes may be specified by text name or by attribute 
number. Attribute numbers are defined as manifest constants in 
PSERVER.CH. Using constants or their literals will give slightly better 
performance than using names.

Text          #define             Attribute
BYTES         PS_BYTES            Bytes printed so far
COPIES        PS_COPIES           Copies printed so far
DESCRIPTION   PS_DESCRIPTION      Job Description
FNAME         PS_FNAME            Name of form
FORMNO        PS_FORMNO           Currently mounted form
JOBNO         PS_JOBNO            Job number
PRINTER       PS_PRINTER          Printer name
QUEUE         PS_QUEUE            Originating queue
SERVER        PS_SERVER           Server with the queue.
STATUS        PS_STATUS           Status

The data types and meanings of these attributes are given below.

BYTES
Numeric. Number of bytes printed so far in the current job. If the 
current job consists of multiple copies, then the number of bytes 
printed so far in the current copy. To obtain the total number of bytes 
in the print job, query the BYTES attribute using N_QJGET().

COPIES
Numeric (0-99). The number of copies printed so far in the print job. 
To obtain the total number of copies in the print job, query the COPIES 
attribute using N_QJGET().

DESCRIPTION
String. Text describing the nature of the job.

FNAME
String. Name of the currently mounted form. A form does not necessarily 
have a name.

FORMNO
Numeric. The number of the currently mounted form.

JOBNO
Numeric. Job number is zero if no job is being serviced. Otherwise, the 
job number is a job ID number that can be used as an argument to 
N_QJGET().

PRINTER
String. Printer name, if any, that corresponds to the printer number 
passed as the second Parameter, <nPrinter>, of N_PSGET().

QUEUE
String. Name of the sending print queue.

SERVER
String. Name of the server with the queue.

STATUS
String. Contains one of the following codes:

Literal       #define             Meaning
A             PS_ACTIVE           Active (printing a job)
D             PS_DOWN             Print server down
E             PS_EMPTY            Empty (out of paper)
F             PS_FORM_WAIT        Waiting for form
I             PS_IDLE             Idle (no jobs in the queue)
O             PS_OFFLINE          Offline
P             PS_PAUSED           Paused

Any of the status codes can be associated with an active job except 
Idle or Down.


Examples

LOCAL aPrinters := {}, aAttribute[4], aSetting[4]
LOCAL nForm := cStatus := nJobNo := nCopies := NIL
N_PSPLIST('PS1', 'printq_q', aPrinters)  // printer list 

// Multiple calls
nForm = N_PSGET('PS1', aPrinters[1], 'FORMNO')
cStatus = N_PSGET( , aPrinters[1], 'STATUS')
nJobNo = N_PSGET( , aPrinters[1], 'JOBNO')
nCopies = N_PSGET( , aPrinters[1],'COPIES')

// Using text names
N_PSGET('PS1', aPrinters[1], ;
        'FORMNO', @nForm,       ;
        'STATUS', @cStatus,     ;
        'JOBNO', @nJobNo,      ;
        'COPIES', @nCopies)

// Using numbers
#include 'PSERVER.CH'
N_PSGET('PS1', aPrinters[1], ;
        PS_FORMNO, @nForm,   ;
        PS_STATUS, @cStatus, ;
        PS_JOBNO, @nJobNo,   ;
        PS_COPIES, @nCopies)

// Using arrays
#include 'PSERVER.CH'
aAttribute[1] = PS_FORMNO
aAttribute[2] = PS_STATUS
aAttribute[3] = PS_JOBNO
aAttribute[4] = PS_COPIES
N_PSGET('PS1', aPrinters[1], aAttribute, aSetting)


Files

PSERVER.CH



See Also: N_PSQLIST() N_PSSET()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson