GT.M pipe for print DEVICE:

From VistApedia
Jump to: navigation, search

With the introduction of the pipe device to GT.M (version V5.3-003) this simpler, more secure, even elegant method can be used:

                  NAME: HP-PHOTOSMART                     
                    $I: <pipe>
      PRE-OPEN EXECUTE: X "o ""p"":(command=""lpr"")::""pipe"" s IO=""p"""
    POST-CLOSE EXECUTE: X "c ""p"""                  
               SUBTYPE: P-OTHER80
                  TYPE: OTHER
 

Note: We use TYPE:Other rather than Host file Server. No host file needed; output will be "piped" to the default CUPS printer. Also the fancy stuff is in the PRE-OPEN EXECUTE. Thus one could do:

      PRE-OPEN EXECUTE: X "o ""p"":(command=""lpr -P Photosmart_@192.168.5.103 -o cpi=12 -o lpi=8 -o page-left=72"")::""pipe"" s IO=""p"""

In human (ok in geekspeak), this last PRE-OPEN EXECUTE says, "Open a pipe device named "p" with the command to print to the CUPS printer named "Photosmart_@192.168.5.103" with the previously mentioned details set, and then set IO to that device." FileMan will then send his output to IO. Finally the POST-CLOSE just closes the pipe. No Linux /tmp/print.txt file to clean up. No fuss, no muss. What's not to love?!?!

--gra'pa Z 06:40, 13 Aug 2009 (EDT)