[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
SET PRINTER
Toggle echo of console output to the printer or set the destination of
printed output
------------------------------------------------------------------------------
Syntax
SET PRINTER on | OFF | <xlToggle>
SET PRINTER TO [<xcDevice> | <xcFile> [ADDITIVE]]
Arguments
ON echoes console output to the printer.
OFF suppresses the printing of console output.
<xlToggle> is a logical expression that must be enclosed in
parentheses. A value of true (.T.) is the same as ON, and a value of
false (.F.) is the same as OFF.
TO <xcDevice> identifies the name of the device where all subsequent
printed output will be sent. You can specify a device name as a literal
character string or a character expression enclosed in parentheses.
Additionally, a device can be either local or network. SETting PRINTER
TO a nonexistent device creates a file with the name of the device.
When specifying device names, do not use a trailing colon.
TO <xcFile> identifies the name of the output file. You can specify
the file name as a literal string or as a character expression enclosed
in parentheses. If a file extension is not specified, .prn is assumed.
ADDITIVE causes the specified output file to be appended to instead
of overwritten. If ADDITIVE is not specified, an existing output file
is truncated before new information is written to it. The ADDITIVE
clause is only meaningful when SETting PRINTER TO an output file.
If SET PRINTER TO is specified with no arguments, the currently
specified device or file is closed and the default destination is then
reselected.
Description
SET PRINTER, like many other SET commands, has two basic forms with each
having its own functionality. The on|OFF form of SET PRINTER controls
whether the output of console commands is echoed to the printer.
Console commands generally do not specify row and column coordinates.
All of these commands, except ?|??, have a TO PRINTER clause that also
directs output to the printer. Output from console commands is
displayed to the screen unless CONSOLE is OFF. Be aware that @...SAYs
are not affected by SET PRINTER ON. To send them to the printer, use
SET DEVICE TO PRINTER instead.
SET PRINTER TO determines the destination of output from all commands
and functions that send output to the printer. This includes @...SAYs
if DEVICE is SET TO PRINTER. Output can be sent to a device or to a
file. If the destination is a device, the following names are valid:
LPT1, LPT2, LPT3 (all parallel ports), COM1, and COM2 (serial ports),
CON and PRN. The default device is PRN.
If the destination is a file, it is created in the current DEFAULT
directory. If a file with the same name exists in the same location, it
is overwritten by the new file without warning. All subsequent output
to the printer is then written to this file until the file is closed
using SET PRINTER TO with no argument.
Use SET PRINTER TO for:
. Managing multiple printers by swapping ports
. Directing output to a file for printing later or for
transferring to a remote computer via telecommunications
. Emptying the printer spooler and resetting the default device
Notes
. Compatibility: CA-Clipper does not support the syntax SET
PRINTER TO \\SPOOLER or \\CAPTURE. Specifying SET PRINTER with
either of these options creates the files Spooler.prn or Capture.prn.
The symbols \\ are ignored.
. End of file marks: When printer output is redirected to a
file, an end of file mark (CHR(26)) is not written when the file is
closed. To terminate a file with an end of file mark, issue a ??
CHR(26) just before the SET PRINTER command that closes the file.
. Networking: For some networks, the workstation's printer
should first be redirected to the file server (usually by running the
network spooler program).
Examples
. This example echoes the output of the ? command to printer,
suppressing the console screen display by SETting CONSOLE OFF:
USE Customer NEW
SET PRINTER ON
SET CONSOLE OFF
DO WHILE !EOF()
? Customer->Name, Customer->Phone
SKIP
ENDDO
EJECT
SET PRINTER OFF
SET CONSOLE ON
CLOSE
RETURN
. This example directs printer output to LPT1 and empties the
print spooler upon completion:
SET PRINTER TO LPT1
<Printing statements>...
SET PRINTER TO // Empty the print spooler
. This example sends printer output to a text file, overwriting
an existing file with the same name:
SET PRINTER TO Prnfile.txt
SET DEVICE TO PRINTER
SET PRINTER ON
//
@ 0, 0 SAY "This goes to Prnfile.txt"
? "So will this!"
//
SET DEVICE TO SCREEN
SET PRINTER OFF
SET PRINTER TO // Close the print file
Files Library is CLIPPER.LIB.
See Also:
@...SAY
EJECT
SET CONSOLE
SET DEVICE
SETPRC()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson