SET PRINTER

From Lianjapedia
Revision as of 04:21, 30 May 2024 by Barrymavin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Redirect printer output

Syntax

SET PRINTER TO [<device> | <filename> [ADDITIVE] | \\SPOOLER | <os-command> | <expC1> | NAME <expC2>]

See Also

APRINTERS(), GETENV(), GETPRINTER(), PRINT, PUTENV(), SET CONSOLE, SET PRINT

Description

The SET PRINTER TO <device> | <filename> command causes output to the printer to be redirected into a file or to a printer attached to a serial communications line. The <device> | <filename> is the name of the target device or filename. This command can be set to a user specific value when the user logs into the system. You can therefore associate groups of people with specific printers, or change the options specified as default with the print command depending on the specific file to be printed.

If the printer output is being directed to a file, specifying the ADDITIVE keyword will cause the output to be appended to any existing file contents rather than overwriting the file.

The SET PRINTER TO \\SPOOLER command causes all textual output to the printer to be stored in a text file on the disk, and then queued to the printer queue for printing when the output is finished. Any commands which have the TO PRINT clause specified cause the current contents of the spool file to be sent to the system printer (as specified in NAME <expC2>).

The SET PRINTER TO <os-command> | <expC1> command works in the same way as SET PRINTER TO \\SPOOLER, except it prints the temporary file with the <os-command>. The <os-command> is any valid operating system print command. The <expC1> must evaluate to a valid operating system print command. The SET PRINTER TO command on its own closes the current print file or device. If the SET PRINTER TO \\SPOOLER command had been specified, the text file is sent to the printer queue.

Example

//
// output text to a file then print it
//
set printer to barry.txt
set print on
set console off
? "hello world"
set print off
set printer to
set console on
Lianja.printFile("printername", "barry.txt")
//
// open the printer port directly
//
set printer to com2:
set print on
set console off
? "hello world"
set print off
set printer to
set console on
//
// spool to default printer
//
// specify the default printer
set printer to name "usb001"
// spool into a temporary file
set printer to \\spooler 
set print on
set console off
? "hello world"
set console on
// send the temporary file to the
// default printer and open a new one
set print off