Setting default session printer

Author: gianni.sandigliano@unifacesolutions.com (gianni)

Hi, when a UAnywhere session is started is remapping local printers to the current session when configured to do so; in our current development/testing environment a UAnywhere session is seeing the following printers: CutePDF Writer (from SCA-K3S-BKP) Microsoft XPS Document Writer PDFCreator Preview PDF (from SCA-K3S-BKP) SCA-K3S-BK is the client machine while the other two printers are hosted on the UAnywhere server machine. This session should use as default printer "PDFCreator", being one of the printers hosted on the UAnywhere server. In our current C/S environment to set default printer in a Uniface session we are using this command: activate "OS".commandout('wmic printer where name='%%DefPrinter%%%' call setdefaultprinter', vOut) but using the same command in a UAnywhere environment to set default printer to a server one is giving back an error. How to set default printer in a UAnywhere session to a printer hosted on UAnywhere server? Any tips/trick/hint is welcome here... Gianni

5 Comments

  1. More info up2now: We start ua-client with "-ac all" switch; all printers on the client as well as all printers on the host server should be available and usable from UA session. A UA client session has to do with TWO default printers: one on client machine and one on server machine. Our need is to define a single session default printer to PDFCreator available on host server side. UA manual is reporting availability of a UA applet showing to enduser printers available either on client as well as on server; this applet is enabling to set default printer for the session. Our need will be solved if we could set default session printer with our program instead of doing it interactively using the UA applet. I am continuing to dig for a solution... Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  2. You can use $setting to find the default printer.  "Software\Microsoft\Windows NT\CurrentVersion\Windows","Device" And we imported a signature for WScript.Network.1 and can then set the default printer using.  newinstance  "WSHN_WSHNETWORK",v_wshnetwork v_wshnetwork->setdefaultprinter($defaultprinter$)


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  3. Should have added, this is working for our existing UA clients. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  4. Iain Sharp said ... And we imported a signature for WScript.Network.1 and can then set the default printer using.  newinstance  "WSHN_WSHNETWORK",v_wshnetwork v_wshnetwork->setdefaultprinter($defaultprinter$)  

    Hi Iain, I was already aware about $setting to read printer connections. I've already tried to set default session printer with other two ways, regularly working in other contexts, with no success! Your tip to use Wscript.Network is a very valuable info! I'll test it soon... Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  5. After efforts I finally reached a logical firm point! It's not a solution to my needs but at least I've understood what is happening... I've initially installed PDFCreator on both Server and Client. Then I've verified I was seeing them as expected from the published UA application as: - PDFCreator (From SCA-K3S-BKP) - PDFCreator Then I've tried to switch Default Printer and printing on both of them: - PDFCreator (From SCA-K3S-BKP) => Print to client - PDFCreator                                       => Print to ??? (nothing happen!) At this point a was in the middle of the river...not being sure to continue to cross it or not...but I've given it a last try! To avoid any mistake I've "humanly" differentiated PDFCreator installed on the client from PDFCreator installed on the server giving them two different names, rispectively PDFCreator_Server and PDFCreator_Client. Then I've put both queue OFFLINE and see what's going to happen. Printing from client platform to client printer: A) when using Uniface application published locally (uniface.exe in a local icon) the spool file is going to PDFCreator Monitor then to the configured file. OK! B) when using Uniface application published on UA (uniface.exe in a UA icon) the spool file is going to Windows Spooler then to PDF Creator Monitor then to the configured file. OK! Printing from client platform to server printer: A) when using Uniface application published locally (uniface.exe in a local icon) the spool file is going to PDFCreator Monitor then to the configured file. OK! B) when using Uniface application published on UA (uniface.exe in a UA icon) the spool file is going to Windows Spooler then to PDF Creator Monitor:      When the spool file is generated remotely it is vanishing in this stage...Very BAD! Log file of PDFMonitor DO NOT report any reference to the vanished spool files...it reported just the ones regularly arriving to PDFCreator Monitor. Either it is: - A limitation of PDFCreator installed - A security issue at System level ...for sure my issue has nothing to do with UAnywhere! Sorry... Now I am looking for a working solution to support my needs... Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)