identity of printer selected

  • usually i print duplex, but occasionall i print to a pdf document that doesn't support this function. Is there a way to execute/not execute "Cprn~Duplex = 2" based on the printer selected? if (printerSelected <> PDFdocumentWriter) then...Oprn~Duplex = 2


    • thanks, Lee.

      this works:

      if all_printers.wt \= 'PDF,CUSTPDF Writer,CPWPT894:' then
      oprn~Duplex = 2

      your script may be useful for another matter: Microsoft Works has the annoying habit of leaving the last printer used as default printer, affecting other apps.


      • Glad I could help. As far as MW is concerned, I have a hatred for any program that changes my printer and doesn't set it back, one that changes my screen resolution, and one that always opens at it's own predetermined screen location and size. If I took the time to re-size and position and application, I want it to "honor" that the next time I use it. :-)

    • Don't see why you couldn't use such code as long as your PDF "printer" is named exactly as you indicated AND you put the name in quotes in the if statement.

      Here's a little script I keep on my quick launch bar - allows me to easily change the default printer without going thru the control panel. You might be able to glean something from it to use in your script.

      / cngprt.rex /

      if RxFuncQuery('InfoMessage') \= 0 then
      call Rxfuncadd 'InfoMessage', 'oodialog', 'InfoMessage'

      default_printer = SysWinGetDefaultPrinter()
      parse var default_printer dp','.
      rv = SysWinGetPrinters(all_printers.)
      do aa = 1 to all_printers.0
          parse var all_printers.aa pname','.
          if pname == dp then do
              default_printer = all_printers.aa
              aprt.aa = pname '(Default)'
              ldp = aa
          else do
              aprt.aa = pname
      aprt.0 = all_printers.0
      m_title = 'Select A Printer For To Set As The Default'
      dlg = .SingleSelection~new('Make A Selection',m_title,aprt.,ldp)
      wt = dlg~execute
      if wt \= '' &amp; all_printers.wt \= default_printer then do
          rv = SysWinSetDefaultPrinter(all_printers.wt)
          default_printer = SysWinGetDefaultPrinter()
          parse var default_printer dp','.
          call infoMessage('Your Default Printer Was Changed To' dp)
      else do
          call infoMessage('Your Default Printer Was NOT Changed')