PxPlus User Forum
Main Board => Discussions => Programming => Topic started by: Jeffrey Ferreira on September 25, 2019, 09:33:32 AM
-
Hello List
I know we can determine a printer from winprt_setup read printer$.
But if i have a call program that i pass print_channel into, is there a way i can determine the printer by examining the print channel.
like a FIN or something
Jeff
-
Does pth(chan) help?
-
WINPRT_SETUP READ will provide the printer definition for the last opened printer so assuming you haven't opened multiple printers, it should get you what you want.
An alternative is to change your open to specify the printer then use PTH to find the device name as in:
->winprt_setup input y$
->open (2) "*winprt*;"+y$
->print pth(2)
*winprt*;HPCDFA5D (HP Officejet 5740 series) on WSD-c8640f5c-7a68-4457-bbad-87b958a2cfa8.003d
-
Thank you everyone
The pth sometime shows it depending how I opened it
I was concerned about other printer opens but I can just do the winprt_setup read right after open and pass the return var around.
I was just wondering if there was some other way I was missing.
jeff
-
Here is a trick -- rather than passing the device name in a variable attach it to the printer using a dummy mnemonic. When you open the printer, get the device name using winprt_setup read X$, then assign that value to a dummy mnemonic such as 'DV'.
Something like this:
->open (1) "*winprt*
->winprt_setup read x$
->mnemonic (1) 'DV'=x$
->print mnm('DV',1)
HPCDFA5D (HP Officejet 5740 series) on WSD-c8640f5c-7a68-4457-bbad-87b958a2cfa8.003d
Now when you want the device name simply access the DV mnemonic for the specified channel.
-
FIN(printer_channel,"DEVICE") should give you your printer.
-}open (unt)"[lcl]*winprt*"
-}? fin(lfo,"device")
\\SBS01\Printer 6 - Administratie Boven
-
Thank you the fin(print_channel,"Device") worked perfect...