Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - set printer to specify the print device http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 set printer to      Specify the print device
------------------------------------------------------------------------------
 Syntax
   set printer to [cDevice] [append]

 Arguments
   cDevice is a print device name given as a character string. Recognized
   print device strings are "PRN", "LPT1", "LPT2", "LPT3", "COM1", "COM2",
   and the empty string "". Any other string is taken as a file name. Device
   names are not case sensitive.

 Description
   The set printer to command specifies the print device.

   set printer to opens the device specified by cDevice, then routes all
   printer output through that device. The default print device is PRN.
   If cDevice is omitted, or is an empty string, or contains an invalid
   file name, then the print device is reset to the default.

   A filename may be specified as the print device. In this case, the file
   is created and opened for writing.

   The append clause controls how the redirection of printer output into
   a file should be handled. With the append option, the output will be
   appended at the end of the capture file (if it already exists), otherwise
   the file contents will be deleted prior to capturing new printer output.
   If the file does not exist, it will be created.

   The append option will be ignored if the printer output is redirected to
   non-file devices.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   vardef
      char(5) aPrinter[5] := "LPT1", "LPT2", "LPT3", "COM1", "COM2"
   enddef
   
   proc Test_setprinterto
   vardef
      _SLIST pList
      uint   uChoice
      char   cAnswer
      uint   n
   enddef
   
   // allow user to select a printer through a pick list
   pList := pickinit()
   for n := 0 to 4
      pickadd( pList, aPrinter[ n ] )
   next
   uChoice := pickdisp( pList, 4, 10, 8, 15 )
   if uChoice
      set printer to pickstr( pList, uChoice )
   endif
   
   // allow user to select printer device
   accept "Send report to F)ile, A)ppend to file or P)rinter? " to cAnswer
   do case
      case cAnswer $ "fF"
         set printer to "report.prn"
      case cAnswer $ "aA"
         set printer to "report.prn" append
      otherwise
         set printer to "LPT1"
   endcase
   endproc

   proc main
   Test_setprinterto()
   endproc

See Also: set print

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