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: LENNART BORGMAN
Subject: Re: Printing from WindowXP version of emacs
Date: Wed, 04 Jan 2006 09:45:10 +0100

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

<div><div>Incidentally, Visual Basic Mode constantly gives me<br>
Invalid regexp: &quot;Invalid regular expression&quot;<br>
errors, when I simply try to hit the Enter key. I believe this is a font-lo=
ck problem. Clues will be appreciated.<br>
</div><br><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid=
 rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">From: E=
li Zaretskii<br>Date: Tue, 03 Jan 2006 21:20:10 +0200</blockquote><br><bloc=
kquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, =
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; &gt; Thanks.&nbsp;&nbsp;The question is, will this script find usable =
ports on<br>&gt; &gt; systems where people report they cannot find a port n=
ame that Emacs<br>&gt; &gt; can use?<br>&gt;<br>&gt; If I run w32prn-custom=
ize I get an error. w32prn-default returns something like
<br>&gt;<br>&gt;&nbsp;&nbsp; PDF-XChange<br>&gt;&nbsp;&nbsp; My Documents\\=
*.pdf<br>&gt;&nbsp;&nbsp; PRINTER15:PASSTHROU<br>&gt;&nbsp;&nbsp; PRINTER15=
:PASSTHROU<br>&gt;&nbsp;&nbsp; PRINTER20:RAW<br><br>What does the VB script=
 display, when run?</blockquote><div><br>
Looks like my alpha release needs some cleaning up.&nbsp; Save the followin=
g code as<br>
getPrn.vbs, then run it with `cscript getPrn.vbs`<br>
First, it should return your *default* printer port<br>
Next, it dumps all the *generally* useful printer info I could find.<br>
Is it fair to say that <br>
&nbsp;&nbsp; letter, legal, a1, b1<br>
cover all the *common* paper sizes, that Emacs should support?<br>
<br>
Let me know, if this new vbs script works. Perhaps I should post the update=
d<br>
code on EmacsWiki, instead of gnu.emacs.sources.<br>
<br>
rem --cut-here--<br>
<br>
rem Copyright 2006 Bruce Ingalls. Licensed via GPL, <a href=3D"http://www.g=
nu.org">http://www.gnu.org</a><br>
rem Modified from<br>
rem <a href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library=
/en-us/wmisdk/wmi/wmi_tasks__printers_and_printing.asp">http://msdn.microso=
ft.com/library/default.asp?url=3D/library/en-us/wmisdk/wmi/wmi_tasks__print=
ers_and_printing.asp
</a><br>
rem <a href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library=
/en-us/wmisdk/wmi/win32_printer.asp">http://msdn.microsoft.com/library/defa=
ult.asp?url=3D/library/en-us/wmisdk/wmi/win32_printer.asp</a><br>
<br>
strComputer =3D &quot;.&quot;<br>
rem note that &quot; _&quot; is line continuation<br>
Set objWMIService =3D GetObject(&quot;winmgmts:&quot; _<br>
&nbsp;&nbsp;&nbsp; &amp; &quot;{impersonationLevel=3Dimpersonate}!\\&quot; =
_<br>
&nbsp;&nbsp;&nbsp; &amp; strComputer &amp; &quot;\root\cimv2&quot;)<br>
Set colInstalledPrinters =3D&nbsp; objWMIService.ExecQuery _<br>
&nbsp;&nbsp;&nbsp; (&quot;Select * from Win32_Printer Where Default =3D Tru=
e&quot;)<br>
For Each objPrinter in colInstalledPrinters<br>
&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;Your printer port is&quot;<br>
&nbsp;&nbsp;&nbsp; If objPrinter.Network then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo objPrinter.Name<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;server &quot; + obj=
Printer.ServerName<br>
&nbsp;&nbsp;&nbsp; ElseIf objPrinter.Local then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo objPrinter.PortName<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo <br>
&nbsp;&nbsp;&nbsp; End If<br>
<br>
&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;shareName &quot; + objPrinter.ShareNa=
me<br>
&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;systemName &quot; + objPrinter.System=
Name<br>
<br>
&nbsp;&nbsp;&nbsp; For Each cap in objPrinter.CapabilityDescriptions<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;capabilities =
&quot; + cap<br>
&nbsp;&nbsp;&nbsp; Next<br>
&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;status &quot; + objPrinter.Status<br>
<br>
rem Wscript.Echo &quot;location &quot; + objPrinter.Location<br>
<br>
&nbsp;&nbsp;&nbsp; For Each psize in objPrinter.PaperSizesSupported<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If psize =3D 7 then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &=
quot;letter size&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ElseIf psize =3D 8 then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &=
quot;legal size&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ElseIf psize =3D 19 then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &=
quot;A1 size&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>
&nbsp;&nbsp;&nbsp; Next<br>
&nbsp;&nbsp;&nbsp; For Each paper in objPrinter.PrinterPaperNames<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;paper size &q=
uot; + paper<br>
&nbsp;&nbsp;&nbsp; Next<br>
<br>
&nbsp;&nbsp;&nbsp; If not objPrinter.ErrorCleared then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo objPrinter.Availability<b=
r>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo objPrinter.ErrorDescripti=
on<br>
&nbsp;&nbsp;&nbsp; End If<br>
Next<br>
<br>
rem --cut-here--<br>
</div></div>

------=_Part_22274_16488965.1136351435778--
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

reply via email to

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