Unfortunately I get C:\mydir\getPrn.vbs(22, 1) (null): 0x80041017 on the line For Each objPrinter in colInstalledPrinters I have a default printer, of course. Content-Type: multipart/alternative; boundary="----=_Part_22274_16488965.1136351435778" ------=_Part_22274_16488965.1136351435778 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Incidentally, Visual Basic Mode constantly gives me Invalid regexp: "Invalid regular expression" errors, when I simply try to hit the Enter key. I believe this is a font-lock problem. Clues will be appreciated. From: Eli Zaretskii > Date: Tue, 03 Jan 2006 21:20:10 +0200 > > Thanks. The question is, will this script find usable ports on > > > systems where people report they cannot find a port name that Emacs > > > can use? > > > > If I run w32prn-customize I get an error. w32prn-default returns > something like > > > > PDF-XChange > > My Documents\\*.pdf > > PRINTER15:PASSTHROU > > PRINTER15:PASSTHROU > > PRINTER20:RAW > > What does the VB script display, when run? Looks like my alpha release needs some cleaning up. Save the following cod= e as getPrn.vbs, then run it with `cscript getPrn.vbs` First, it should return your *default* printer port Next, it dumps all the *generally* useful printer info I could find. Is it fair to say that letter, legal, a1, b1 cover all the *common* paper sizes, that Emacs should support? Let me know, if this new vbs script works. Perhaps I should post the update= d code on EmacsWiki, instead of gnu.emacs.sources. rem --cut-here-- rem Copyright 2006 Bruce Ingalls. Licensed via GPL, http://www.gnu.org rem Modified from rem http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/wmisdk/w= mi/wmi_tasks__printers_and_printing.asp rem http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/wmisdk/w= mi/win32_printer.asp strComputer =3D "." rem note that " _" is line continuation Set objWMIService =3D GetObject("winmgmts:" _ & "{impersonationLevel=3Dimpersonate}!\\" _ & strComputer & "\root\cimv2") Set colInstalledPrinters =3D objWMIService.ExecQuery _ ("Select * from Win32_Printer Where Default =3D True") For Each objPrinter in colInstalledPrinters Wscript.Echo "Your printer port is" If objPrinter.Network then Wscript.Echo objPrinter.Name Wscript.Echo Wscript.Echo "server " + objPrinter.ServerName ElseIf objPrinter.Local then Wscript.Echo objPrinter.PortName Wscript.Echo End If Wscript.Echo "shareName " + objPrinter.ShareName Wscript.Echo "systemName " + objPrinter.SystemName For Each cap in objPrinter.CapabilityDescriptions Wscript.Echo "capabilities " + cap Next Wscript.Echo "status " + objPrinter.Status rem Wscript.Echo "location " + objPrinter.Location For Each psize in objPrinter.PaperSizesSupported If psize =3D 7 then Wscript.Echo "letter size" ElseIf psize =3D 8 then Wscript.Echo "legal size" ElseIf psize =3D 19 then Wscript.Echo "A1 size" End If Next For Each paper in objPrinter.PrinterPaperNames Wscript.Echo "paper size " + paper Next If not objPrinter.ErrorCleared then Wscript.Echo objPrinter.Availability Wscript.Echo objPrinter.ErrorDescription End If Next rem --cut-here-- ------=_Part_22274_16488965.1136351435778 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
From: E= li Zaretskii
Date: Tue, 03 Jan 2006 21:20:10 +0200