Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
What I believe to be the bug occurs when using the pGetDefPrtInf command before using the pGetPrtInfo command. Review the following code and comments (which was whipped up for demonstration):
; Initialize extender and get printer list AddExtender("WWPRT34i.DLL") printers = pGetPrtList(0) ; Offer list to user -- choose a local printer chosen = AskItemList("Printers", printers, @tab, @sorted, @single) ; Display the server name. ; If you chose a local printer, the message box should be blank srvname = pGetPrtInfo(chosen, 1) Message ("Before",srvname) ; Now grab the default printer info defprt = pGetDefPrtInf(1) ; Excute the same command as above. ; This time, the server name will be populated -- this is the bug. srvname = pGetPrtInfo(chosen, 1) Message ("After",srvname) ExitAs mentioned in the comments, after the pGetDefPrtInf command is called, the server name for local printers gets populated. So am I going insane? Or is this a bug? (perhaps both?)
Debug output is as follows:
************************************************************ *** Debug Initialized *** ============================== Wed 6/23/2004 4:29:15 PM WinBatch 32 2004A WIL DLL 4.4add \\hscinstall\scripts\code\msm Packages\PrinterInv\temp.exe Windows platform: NT, version: 5.0, build: 2195 (Service Pack 4) ============================== ----- Extender loaded: \\hscinstall\scripts\code\msm Packages\PrinterInv\WWPRT34i.DLL (file version: 39004,0,0,0) AddExtender("WWPRT34i.DLL") (60) VALUE=> 1 printers = pGetPrtList(0) (70) VALUE=> "Microsoft Office Document Image Writer HP LaserJet 5 Acrobat PDFWriter Acrobat Distiller \\hscsprint1\STHMT03 \\hscsprint3\STHMT11 \\hscsprint3\STHMT13" chosen = AskItemList("Printers", printers, @tab, @sorted, @single) (5658) VALUE=> "HP LaserJet 5" srvname = pGetPrtInfo(chosen, 1) (5668) VALUE=> "" Message ("Before",srvname) (8152) VALUE=> 1 defprt = pGetDefPrtInf(1) (8152) VALUE=> "HP LaserJet 5" srvname = pGetPrtInfo(chosen, 1) (8162) VALUE=> "HP LaserJet 5" Message ("After",srvname) (9634) VALUE=> 1 Exit (9634) VALUE=> 0 --- Normal termination --- ;;;END OF JOB;;;As you can see from the debug file posted above, the first time I call the function against the local printer, I get a blank string. The second time I call the same function (after calling pGetDefPrtInf) I get a value and NOT a blank string.
Note: This is a 44I version of the extender, requiring you to update to the current version of WinBatch, anc to edit the AddExtender line in your script.
Article ID: W16354
File Created: 2005:02:18:12:19:58
Last Updated: 2005:02:18:12:19:58