Command SET DEVICE Foundation

Specifies the output device for output performed using @...SAY.

Syntax
SET DEVICE TO SCREEN | printer
Scope
process-wide
Parameters
SCREEN
The option SCREEN specifies the screen as the output device for all output using @...SAY. This output is independent of the SET CONSOLE setting.
PRINTER
The option PRINTER diverts all output of the command @...SAY to the output device set with the command SET PRINTER TO.
Description

The command SET DEVICE determines the device for output performed by the command @...SAY or the function DevOut(). The default output device is the screen and is set with the option SCREEN.

Following the command SET DEVICE TO PRINTER, output from @...SAY is sent to the printer. Characters are sent to the printer and the values of the functions PRow() and PCol() are updated to reflect the new print head position. If the row position for output is less than the internal row counter of the function PRow(), an automatic form feed (EJECT command) occurs before output. The print head is then positioned at the start of the next page. This automatic behavior can be suppressed if the internal counter of PRow() and PCol() is set prior to output to smaller values by the function SetPrc(). When the left margin is set using the command SET MARGIN TO, this value is added to the column counter when positioning the print head.

SET DEVICE directs output of the command @...SAY to either the screen or the printer. After the command SET DEVICE TO PRINTER, output from @...SAY appears on the printer and does not appear on the screen. Output of the command @...SAY also reflects the current margin set with the command SET MARGIN.

Output using @...SAY can be sent to a file when the output device is set with SET DEVICE TO PRINTER and the print output is directed to a file using SET PRINTER TO <cFileName>.

Examples
SET DEVICE
// In the example, addresses from an address file are listed. 
// Output only occurs at the printer and not on the screen. 

PROCEDURE Main 
   USE Address NEW 

   SET DEVICE TO PRINTER 

   DO WHILE .NOT. Eof() 
      @ 0, 0 SAY Trim(FName) +" "+ Trim(LName) 
      @ 1, 0 SAY Trim(Street) 
      @ 2, 0 SAY Trim(City) + ", " + State + " " + Zip 
      @ 3, 0 SAY "" 
      SetPrc( 0 ,0 ) 

      SKIP 
   ENDDO 

   SET DEVICE TO SCREEN 

RETURN 
Output from @...SAY sent to a file
// The example is identical to the first example, 
// except that the output is sent to a file. 

PROCEDURE Main 
   USE Address NEW 

   SET PRINTER TO Label.txt     // determine output file 
   SET DEVICE TO PRINTER        // determine output device 
   DO WHILE .NOT. Eof() 
      @ 0, 0 SAY Trim(FName) +" "+ Trim(LName) 
      @ 1, 0 SAY Trim(Street) 
      @ 2, 0 SAY Trim(City) + ", " + State + " " + Zip 
      @ 3, 0 SAY "" 
      SetPrc( 0 ,0 ) 

      SKIP 
   ENDDO 

   SET PRINTER TO 
   SET DEVICE TO SCREEN 

RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.