Looks like my alpha release needs some cleaning up. Save the following code 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 updated
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=/library/en-us/wmisdk/wmi/wmi_tasks__printers_and_printing.asp
rem
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_printer.asp
strComputer = "."
rem note that " _" is line continuation
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Default = 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 = 7 then
Wscript.Echo "letter size"
ElseIf psize = 8 then
Wscript.Echo "legal size"
ElseIf psize = 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--