PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Determining Printer from Print Channel  (Read 1874 times)

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 175
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Determining Printer from Print Channel
« 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

Allen Miglore

  • Silver Member
  • ***
  • Posts: 38
    • View Profile
    • UnForm
Re: Determining Printer from Print Channel
« Reply #1 on: September 25, 2019, 10:40:58 AM »
Does pth(chan) help?

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Determining Printer from Print Channel
« Reply #2 on: September 25, 2019, 10:48:13 AM »
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


Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 175
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Determining Printer from Print Channel
« Reply #3 on: September 25, 2019, 11:04:14 AM »
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

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Determining Printer from Print Channel
« Reply #4 on: September 25, 2019, 11:30:09 AM »
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.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

koenv

  • Member
  • **
  • Posts: 12
    • View Profile
Re: Determining Printer from Print Channel
« Reply #5 on: September 26, 2019, 03:32:24 AM »
FIN(printer_channel,"DEVICE") should give you your printer.

-}open (unt)"[lcl]*winprt*"
-}? fin(lfo,"device")
\\SBS01\Printer 6 - Administratie Boven

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 175
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Determining Printer from Print Channel
« Reply #6 on: September 26, 2019, 07:56:31 AM »
Thank you the fin(print_channel,"Device") worked perfect...