unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: LENNART BORGMAN <lennart.borgman.073@student.lu.se>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Printing from WindowXP version of emacs
Date: Wed, 04 Jan 2006 09:45:10 +0100	[thread overview]
Message-ID: <47f866747f622f.47f622f47f8667@net.lu.se> (raw)

[-- Attachment #1: Type: text/plain, Size: 8767 bytes --]

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

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 152 bytes --]

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

             reply	other threads:[~2006-01-04  8:45 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-04  8:45 LENNART BORGMAN [this message]
2006-01-04 18:22 ` Printing from WindowXP version of emacs Eli Zaretskii
2006-01-04 19:14   ` Lennart Borgman
2006-01-05  1:17 ` BRUCE INGALLS
  -- strict thread matches above, loose matches on Subject: below --
2006-01-10 10:19 LENNART BORGMAN
2006-01-09  8:29 LENNART BORGMAN
2006-01-09 11:42 ` Lennart Borgman
2006-01-10  3:13   ` BRUCE INGALLS
2006-01-08  1:06 BRUCE INGALLS
2006-01-08  4:12 ` Eli Zaretskii
2006-01-07  5:00 BRUCE INGALLS
2006-01-07  9:18 ` Eli Zaretskii
2006-01-05  9:24 LENNART BORGMAN
2006-01-05 16:43 ` Eli Zaretskii
2006-01-05 21:01   ` Lennart Borgman
2006-01-06  9:09     ` Eli Zaretskii
2006-01-04  5:10 BRUCE INGALLS
2006-01-04  0:34 BRUCE INGALLS
2006-01-04 10:00 ` Peter Dyballa
2006-01-05  1:56   ` BRUCE INGALLS
2006-01-05 13:01     ` Peter Dyballa
2006-01-05 15:41       ` Lennart Borgman
2006-01-05 21:17         ` Peter Dyballa
2006-01-06  8:39           ` Eli Zaretskii
2006-01-05 20:44       ` Eli Zaretskii
2006-01-05 21:18         ` Peter Dyballa
2006-01-06  8:36           ` Eli Zaretskii
2006-01-06 11:59             ` Peter Dyballa
2006-01-06 14:07               ` Eli Zaretskii
2006-01-03 13:08 LENNART BORGMAN
2006-01-03 19:20 ` Eli Zaretskii
2006-01-03  0:49 BRUCE INGALLS
2006-01-03  5:10 ` Eli Zaretskii
2006-01-03  9:44 ` Peter Dyballa
     [not found] ` <mailman.21202.1136265134.20277.help-gnu-emacs@gnu.org>
2006-01-03 13:06   ` Chris McMahan
2006-01-03 19:18     ` Eli Zaretskii
2006-01-03 21:52       ` Lennart Borgman
     [not found]       ` <mailman.21297.1136325265.20277.help-gnu-emacs@gnu.org>
2006-01-03 22:08         ` David Kastrup
2006-01-03 22:12           ` Lennart Borgman
     [not found] <mailman.19907.1135077565.20277.help-gnu-emacs@gnu.org>
2005-12-20 17:15 ` Mathias Dahl
2005-12-20 10:58 LENNART BORGMAN
     [not found] <mailman.19804.1134991437.20277.help-gnu-emacs@gnu.org>
2005-12-19 16:28 ` Mathias Dahl
2005-12-19 11:18 LENNART BORGMAN
2005-12-19 21:29 ` Eli Zaretskii
2005-12-19 22:11   ` Lennart Borgman
2005-12-19 23:05     ` Eli Zaretskii
2005-12-19 23:30       ` Lennart Borgman
2005-12-20  4:30         ` Eli Zaretskii
2005-12-15 19:36 Jay Bingham
2005-12-15 15:31 sbrown
2005-12-15 18:30 ` Mathias Dahl
2005-12-15 18:35 ` Lennart Borgman
2005-12-16  7:50   ` Eli Zaretskii
2005-12-16  8:29     ` Lennart Borgman
2005-12-16  8:53       ` Eli Zaretskii
2005-12-16 14:53         ` Lennart Borgman
2005-12-16 15:31           ` Eli Zaretskii
2005-12-17  2:42             ` Lennart Borgman
2005-12-17  8:20               ` Eli Zaretskii
2005-12-17  9:38                 ` Peter Dyballa
2005-12-17 11:11                   ` Eli Zaretskii
2005-12-17 15:50                     ` Lennart Borgman
2005-12-17 16:31                       ` Peter Dyballa
2005-12-17 21:25                         ` Lennart Borgman
2005-12-17 23:55                           ` Peter Dyballa
2005-12-21 18:15                             ` Lennart Borgman
2005-12-21 21:51                               ` Eli Zaretskii
2005-12-21 22:50                                 ` Lennart Borgman
2005-12-21 23:41                                   ` Edward O'Connor
2005-12-21 23:51                                     ` Lennart Borgman
2005-12-17  9:51                 ` Lennart Borgman
2005-12-17 13:11                   ` Lennart Borgman
     [not found]               ` <mailman.19684.1134911288.20277.help-gnu-emacs@gnu.org>
2005-12-18 18:22                 ` Ilya Zakharevich
2005-12-18 19:23                   ` Eli Zaretskii
     [not found]                   ` <mailman.19772.1134933877.20277.help-gnu-emacs@gnu.org>
2005-12-19 17:53                     ` Ilya Zakharevich
2005-12-19 21:43                       ` Eli Zaretskii
     [not found]                       ` <mailman.19861.1135028638.20277.help-gnu-emacs@gnu.org>
2005-12-20  1:11                         ` Ilya Zakharevich
2005-12-20  4:54                           ` Eli Zaretskii
     [not found]                           ` <mailman.19893.1135054520.20277.help-gnu-emacs@gnu.org>
2005-12-20 22:40                             ` Ilya Zakharevich
2005-12-21  4:42                               ` Eli Zaretskii
     [not found]                               ` <mailman.20004.1135140203.20277.help-gnu-emacs@gnu.org>
2005-12-22 23:11                                 ` Ilya Zakharevich
2005-12-23  8:41                                   ` Eli Zaretskii
     [not found]                                   ` <mailman.20241.1135327583.20277.help-gnu-emacs@gnu.org>
2005-12-30  0:38                                     ` Ilya Zakharevich
2005-12-30 11:44                                       ` Eli Zaretskii
     [not found]                                       ` <mailman.20871.1135945105.20277.help-gnu-emacs@gnu.org>
2006-01-05  6:53                                         ` Ilya Zakharevich
2006-01-05 16:39                                           ` Eli Zaretskii
     [not found]                                           ` <mailman.21485.1136479302.20277.help-gnu-emacs@gnu.org>
2006-01-07 12:02                                             ` Ilya Zakharevich
2006-01-07 12:55                                               ` Eli Zaretskii
2005-12-20 14:45                         ` Peter Boettcher
2005-12-20 20:21                           ` Eli Zaretskii
2005-12-20 22:22                             ` Lennart Borgman
2005-12-21  4:34                               ` Eli Zaretskii
2005-12-21  7:49                                 ` Lennart Borgman
2005-12-21 18:39                                   ` Lennart Borgman
2005-12-21 19:33                                   ` Eli Zaretskii
2005-12-21 20:11                                     ` Lennart Borgman
2005-12-21 22:15                                       ` Eli Zaretskii
2005-12-21 22:48                                         ` Lennart Borgman
2005-12-22  4:38                                           ` Eli Zaretskii
2005-12-22  8:02                                             ` Lennart Borgman
2005-12-22 19:37                                               ` Eli Zaretskii
2005-12-22 20:46                                                 ` Lennart Borgman
2005-12-23  8:21                                                   ` Eli Zaretskii
2005-12-23 14:06                                                     ` Lennart Borgman
2005-12-23 15:20                                                       ` Eli Zaretskii
2005-12-24 13:49                                                         ` Eli Zaretskii
2005-12-24 14:39                                                           ` Eli Zaretskii
2005-12-24 14:58                                                             ` Eli Zaretskii
2005-12-16  9:26       ` Peter Dyballa
2005-12-16 10:45         ` Eli Zaretskii
2005-12-16  9:19     ` Peter Dyballa
2005-12-16 10:46       ` Eli Zaretskii
2005-12-16 14:19       ` Lennart Borgman
     [not found]   ` <mailman.19545.1134911104.20277.help-gnu-emacs@gnu.org>
2005-12-19  9:58     ` Mathias Dahl
2005-12-19 21:25       ` Eli Zaretskii
     [not found]       ` <mailman.19857.1135027571.20277.help-gnu-emacs@gnu.org>
2005-12-20  7:41         ` Mathias Dahl
2005-12-20 19:58           ` Eli Zaretskii
2005-12-20 20:59             ` Drew Adams
2005-12-15 19:36 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47f866747f622f.47f622f47f8667@net.lu.se \
    --to=lennart.borgman.073@student.lu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).