help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing from WindowXP version of emacs


From: BRUCE INGALLS
Subject: Re: Printing from WindowXP version of emacs
Date: Wed, 4 Jan 2006 00:10:35 -0500

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 _vbscript_ display, when run?

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=""
rem http://msdn.microsoft.com/library/default.asp?url="">

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--

reply via email to

[Prev in Thread] Current Thread [Next in Thread]