unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: Printing from WindowXP version of emacs
@ 2005-12-19 11:18 LENNART BORGMAN
  2005-12-19 21:29 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: LENNART BORGMAN @ 2005-12-19 11:18 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Mathias Dahl <brakjoller@gmail.com>

> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > If we need to use external programs at all (and I know of only one
> > such case: when the printer in question is a network printer 
> that is
> > not available as a Windows share of the form 
> \\server\share\printer),> then I'd suggest a free program called 
> PrintFile32 (available from
> > http://www.lerup.com/printfile/).  Configure Emacs to use it as a
> > replacement for the Unix lpr program.
> >
> > But I'd like first to hear from the OP which of the advice he's been
> > given he tried, and what and how didn't work.  In most cases, it is
> > not necessary to use external programs, as Emacs can do the job
> > itself.
> 
> I just wanted to say that I just tested doing what the documentation
> for printer-name says; that is to set it to the name of a shared
> printer in our network.
> 
> So I set it to "//gbgfs1/gbg2b" and then called M-x lpr-buffer
> 
> It worked. 
> 
> I did not test with colors (it is no color printer) but that probably
> won't work in the same way, will it?
> 
> Btw, I first tested without setting printer-name (which on Windows XP
> has the default value PRN) and printed, and Emacs froze. Don't know
> why though.

I tested here at some printers to see if I was mistaken earlier. To avoid confusion I am testind just from a command shell. What I have done is this:

I take some printer queues on different printers which I normally use without problems. I look at the header in printer queue w32 window to find the host for the printer queue. Then I do

    c:\> copy file.txt \\host-name\queue-name

To my surprise it worked for the first queue. For the next queue I got

    The network path was not found.
        0 file(s) copied.

To be sure on what I am doing I then went to the host for the queue to find the share name instead of the queue name:


    c:\> copy file.txt \\host-name\share-name

This swallowed the job but I get no output and nothing is shown in the printer queue (where I normally see all waiting jobs). 

I believe this is what I found last time I tested about two years ago too. It seems that in some circumstances it actually could work, but not in all. That can explain why it has been so hard trying to clear this out. 

This is why I am recommending using the web browser for printing with htmlize-view.el on MS Windows. It may seem awkward but it works and the output is actually nice IMHO.

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-10 10:19 LENNART BORGMAN
  0 siblings, 0 replies; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-10 10:19 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: BRUCE INGALLS <bruce.ingalls@gmail.com>

> That sure does not look right. Here's how you can test it, from the
> Windows command line:
>  net view \\host-name

Works ok. Though the name "1234567890" is in the list (a very long list BTW).


>  print /D:\\host-name\1234567890 file.txt

Does not work. I believe the reason is that the printer is not in the state required by this command (as I explained in other messages).


...
> Save the above as getPrn2.vbs, and run
>  cscript getPrn2.vbs

There are several problems with this code. All printers are not networked for example. I am using W2k, not XP however.

 
> If the output from this script does not `net view`, nor `print`, then
> some sys admin is in order, because it tested fine for me.

I do not think any sys admin is in order here - there is nothing I can do about that. The printers works ok, but not in this way.

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-09  8:29 LENNART BORGMAN
  2006-01-09 11:42 ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-09  8:29 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Eli Zaretskii <eliz@gnu.org>

> > Date: Sat, 7 Jan 2006 00:00:24 -0500
> > From: BRUCE INGALLS <bruce.ingalls@gmail.com>
> > 
> > > > Date: Thu, 05 Jan 2006 22:01:16 +0100
> > > > From: Lennart Borgman
> > > >
> > > > >>(default-printer-name) returns \\host-name\1234567890
> > > > >>
> > 
> > > > Ehum, I did not test because it looks so very strange. I 
> will try it
> > > > next week. Do you really expect something like that to work? 
> I mean it
> > > > is exactly those figures I wrote above.
> > 
> > That sure does not look right.
> 
> What doesn't look right, exactly?  I took the above as a template, not
> as a literal string that is the printer's name.  If it's a literal
> string, then it is indeed strange, but default-printer-name simply
> calls GetProfileString and GetPrinter APIs, so whatever those return,
> it's the system's notion of the printer.  Unless there's a bug in
> default-printer-name, in which case please step through it and tell
> what goes wrong there.

I have felt a bit nervous over the weekend. Did I really test this with -Q? Or is it something long forgotten I have in my initialization files.

I tried again with -Q. And yes, it is literally the share name I told ("1234567890").

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-08  1:06 BRUCE INGALLS
  2006-01-08  4:12 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-08  1:06 UTC (permalink / raw)


> From: Eli Zaretskii
> Date: Sat, 07 Jan 2006 11:18:43 +0200
> Subject:
> > Date: Sat, 7 Jan 2006 00:00:24 -0500
> > > > Date: Thu, 05 Jan 2006 22:01:16 +0100
> > > > From: Lennart Borgman
> > > >
> > > > >>(default-printer-name) returns \\host-name\1234567890
> > > >... Do you really expect something like that to work? I mean it
> > > > is exactly those figures I wrote above.
> >
> > That sure does not look right.
>
> What doesn't look right, exactly?  I took the above as a template, not
> as a literal string that is the printer's name.  If it's a literal
> string, then it is indeed strange, but default-printer-name simply
> calls GetProfileString and GetPrinter APIs, so whatever those return,
> it's the system's notion of the printer.  Unless there's a bug in
> default-printer-name, in which case please step through it and tell
> what goes wrong there.

Agreed. Lennart did say "exactly".
I did not realize that Emacs already had w32 default-printer code.
Does anyone know, or can provide suggestions for default printers for
other platforms, such as mac osx, gnome, kde?
Do the alpha releases of Emacs on w32 set printer-name to default-printer-name?
If so, then w32 printing should already be easy. As per this thread,
all that should remain, is to set a printing-method customize variable
for plain/postscript/ghostscript/htmlize-view, and to make it go.

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-07  5:00 BRUCE INGALLS
  2006-01-07  9:18 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-07  5:00 UTC (permalink / raw)


> > Date: Thu, 05 Jan 2006 22:01:16 +0100
> > From: Lennart Borgman
> >
> > >>(default-printer-name) returns \\host-name\1234567890
> > >>

> > Ehum, I did not test because it looks so very strange. I will try it
> > next week. Do you really expect something like that to work? I mean it
> > is exactly those figures I wrote above.

That sure does not look right. Here's how you can test it, from the
Windows command line:
  net view \\host-name
  print /D:\\host-name\1234567890 file.txt

I found a bug in the getPrn.vbs I had emailed, where it did not return
the proper network printer port. Here is the essential getPrn.vbs,
with the fix:

REM --begin--

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")
rem    ("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters
    Wscript.Echo "Your printer port is"
    If objPrinter.Network then
       Wscript.Echo objPrinter.ServerName + "\" + objPrinter.ShareName
       Wscript.Echo
    ElseIf objPrinter.Local then
       Wscript.Echo objPrinter.PortName
       Wscript.Echo
    End If
Next

REM --end--

Save the above as getPrn2.vbs, and run
  cscript getPrn2.vbs

If the output from this script does not `net view`, nor `print`, then
some sys admin is in order, because it tested fine for me.
At that point, `net help`, `net use help`, and control panel are your friends.

OTOH, if this does work, I'd say we are ready to write some elisp
code, and user docs.
I suggest that this be written as a M-x Customize plugin (pardon my
fast & loose terms), with htmlize-view as the default (assuming it can
be found in load-path, and Emacs is currently in GUI mode), then
postscript, if gsview is in the path, then finally, plain text.
There is a way to use WMI (see getPrn.vbs code, and its URIs) to query
for PostScript support, but I could not get it to work reliably.

If this approach for Windows code meets consensus, I intend to move on
to working with Linux/OSX/Cygwin printing. I would need help testing,
however, as my hardware variety is limited.

Incidentally, does htmlize-view.el work well with Lynx or (e)links?
Beyond console mode, is w3.el (or w3m?) an adequate fallback?

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-05  9:24 LENNART BORGMAN
  2006-01-05 16:43 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-05  9:24 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Eli Zaretskii <eliz@gnu.org>

> Also, I asked to see what does default-printer-name return on that
> platform.  It's a Windows-specific function that is supposed to do
> something similar to Bruce's VB script.  Can you tell what is its
> result on that system?

(default-printer-name) returns \\host-name\1234567890

where host-name is the name where the printer queue is.

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-04  8:45 LENNART BORGMAN
  2006-01-04 18:22 ` Eli Zaretskii
  2006-01-05  1:17 ` BRUCE INGALLS
  0 siblings, 2 replies; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-04  8:45 UTC (permalink / raw)
  Cc: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-04  5:10 BRUCE INGALLS
  0 siblings, 0 replies; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-04  5:10 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 3079 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 5098 bytes --]

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

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-04  0:34 BRUCE INGALLS
  2006-01-04 10:00 ` Peter Dyballa
  0 siblings, 1 reply; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-04  0:34 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1427 bytes --]

>
> From: Peter Dyballa
> Date: Tue, 3 Jan 2006 10:44:15 +0100
> Subject: Re: Printing from WindowXP version of emacs
>
> > That said, yet another hack is available: there already is code to
> > export emacs buffers to PDF.
>
> Could you drop some names, please?


Feel free to browse http://EMacro.sf.net/ for more of this stuff.
I expect to make a new release, this month.
Here is the relevant code, from e-common.el:

;;Note that ps2pdf might not be installed
(defun save-current-buffer-as-pdf ()
  "Export pretty-printed file to PDF format."
  (interactive)
  (ps-print-buffer-with-faces (concat (buffer-file-name) ".ps"))
  (shell-command (concat "ps2pdf " (buffer-file-name) ".ps"))
  (delete-file (concat (buffer-file-name) ".ps"))
  (message "Done"))

(defvar cache-htmlize)            ;shut up compiler
(cache-locate-library
 use-cache 'cache-htmlize "htmlize"
 "To export as HTML, get htmlize.el from <url:
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el>")

(when cache-htmlize (require 'htmlize))

(when (or cache-htmlize (which "ps2pdf"))
  (easy-menu-change file-menu "Export As"
            (list
             ["PDF" save-current-buffer-as-pdf
              (if (which "ps2pdf") t nil)] ;enable only if in PATH
             ["HTML" htmlize-buffer
              (if cache-htmlize t nil)])))

;;note that cache-htmlize can be replaced by a slower call to
locate-library()

[-- Attachment #1.2: Type: text/html, Size: 2297 bytes --]

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

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-03 13:08 LENNART BORGMAN
  2006-01-03 19:20 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-03 13:08 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Eli Zaretskii <eliz@gnu.org>

> > From: BRUCE INGALLS <bruce.ingalls@gmail.com>
> > 
> > Windows version 2000 and higher, are bundled with VBScript & 
> JScript, by
> > default.
> > I had posted code to gnu.emacs.sources, in Sept. 2005, a way to 
> retrieve the
> > default printer port into Emacs:
> > 
> > 
> http://groups.google.com/group/gnu.emacs.sources/browse_thread/thread/a9f1a308223bc3b9/e2cf485072e3164b#e2cf485072e3164b> 
> > You can easily query all manner of Windows printer properties,
> > and customize the code above, to bring such into Emacs.
> 
> 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

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Re: Printing from WindowXP version of emacs
@ 2006-01-03  0:49 BRUCE INGALLS
  2006-01-03  5:10 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-03  0:49 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1601 bytes --]

I had been looking for a way to script the MS Windows Printing Common Dialog
Box, to make it available for Emacs.
It looks that it requires some C(++) code, which I had been avoiding, to
make a no-arch package.
Perhaps I shall write a command-line, or otherwise Emacs usable wrapper, one
day.

Windows version 2000 and higher, are bundled with VBScript & JScript, by
default.
I had posted code to gnu.emacs.sources, in Sept. 2005, a way to retrieve the
default printer port into Emacs:

http://groups.google.com/group/gnu.emacs.sources/browse_thread/thread/a9f1a308223bc3b9/e2cf485072e3164b#e2cf485072e3164b

You can easily query all manner of Windows printer properties,
and customize the code above, to bring such into Emacs.

Htmlview & notepad make fine stop-gap measures, to make w32 emacs printing
easier.
However, I don't believe there has been a good explanation, as to why some
zealously believe
that printing must be embedded in, or dedicated to, Emacs.

Essentially, this violates the principle of coupling (and cohesion).
Say, you use Emacs to print ESS spreadsheets, or 132 column code dumps.
This makes sense to do in landscape mode.

However, you might be surprised, when your browser stops printing web pages
in portrait mode.
Next, imagine the impact of intermediate print filter programs, such as
a2ps.

That said, yet another hack is available: there already is code to export
emacs buffers to PDF.
I don't know, if a command-line pdf printing program exists.
I suspect that this will be a slow solution, that leaves garbage files
strewn about.

[-- Attachment #1.2: Type: text/html, Size: 1845 bytes --]

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

^ permalink raw reply	[flat|nested] 119+ messages in thread
[parent not found: <mailman.19907.1135077565.20277.help-gnu-emacs@gnu.org>]
* Re: Printing from WindowXP version of emacs
@ 2005-12-20 10:58 LENNART BORGMAN
  0 siblings, 0 replies; 119+ messages in thread
From: LENNART BORGMAN @ 2005-12-20 10:58 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Eli Zaretskii <eliz@gnu.org>

> > >You can use the "net use" command to arrange for some port, 
> like LPT2,
> > >to redirect its output to this printer.  (I think this is 
> explained in
> > >the Emacs manual.)  Then all you need to do to print is to set
> > >printer-name to "LPT2",
> > >  
> > >
> > I will try, but is there any technical reason to assume that 
> this works 
> > differently?
> 
> I don't know, it's hard to tell without taking a good look at how your
> printers are configured on that specific system.
> 
> > I guess I can then do
> > 
> >    copy file.txt lpt2:
> 
> Yes (but lose the colon after "lpt2", it's redundant).

I have tried this now. First I tried

   net use LPT2: \\host-name\queue-but-not-share-name

This queue name is not a share name too and I just got

    System error 67 has occured.
    The network name can not be found.

Then I used another queue name which is also a share name:

    net use LPT2: \\host-name\share-and-queue-name 

This completed fine. Then I did

    copy file.txt LTP2

No error, but also no output on the printer. Just as before. I also tried using LPT2:. (I also did a "dir L*" ;-)

Suggestions?

^ permalink raw reply	[flat|nested] 119+ messages in thread
[parent not found: <mailman.19804.1134991437.20277.help-gnu-emacs@gnu.org>]
* RE: Printing from WindowXP version of emacs
@ 2005-12-15 19:36 Jay Bingham
  0 siblings, 0 replies; 119+ messages in thread
From: Jay Bingham @ 2005-12-15 19:36 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1786 bytes --]

<Send replies only to the list not to this address>
In a message dated Thursday, December 15, 2005 9:32 AM sbrown@raytheon.com wrote:
> I am running GNU emacs v.21.3.1 on my Windows XP system.   Everything
> works as it should - except printing.  I am attempting to use a Xerox
> Workcenter Pro 238 on a Microsoft Network.  I have spent hours on the
> web looking at all the advice on how to get printing to work.  Nothing
> seems to help.  Is there a concise statement of how to make this work
> somewhere?  Sure am getting tired of copying out of emacs and pasting
> into Notepad just to be able to print.
Steve,
It might help to know what you have tried, so that those who respond will have
an idea of what is not working for you.  I am not sure what you found on the
Internet or why you were even looking there because all the information that I
needed to get printing working from windows was in the Emacs info nodes.
I have the following in my .emacs.  I have no trouble printing from Emacs
v.21.3 to a networked HP printer (I have printed to other brands of printers as
well) from Windows 2000 PRO (XP should not be any different, I did not need to
change any settings when I upgraded to Win2K from WinNT):
;; set the printer command to null
(setq  lpr-command "")
;; set the default printer name
(setq printer-name "//txnprt01/ps8")
;; set the Postscript printer command to null
(setq  ps-lpr-command "")
;; set the default Postscript printer name
(setq ps-printer-name "//txnprt01/ps8")
;; Turn on duplex printing
(setq ps-spool-duplex t)

-_
J_)
C_)ingham
.    Hewlett-Packard
.    Austin, TX
. "Language is the apparel in which your thoughts parade in public.
.  Never clothe them in vulgar and shoddy attire."     -Dr. George W. Crane-


[-- Attachment #1.2: Type: text/html, Size: 2081 bytes --]

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

^ permalink raw reply	[flat|nested] 119+ messages in thread
* Printing from WindowXP version of emacs
@ 2005-12-15 15:31 sbrown
  2005-12-15 18:30 ` Mathias Dahl
                   ` (2 more replies)
  0 siblings, 3 replies; 119+ messages in thread
From: sbrown @ 2005-12-15 15:31 UTC (permalink / raw)


I am running GNU emacs v.21.3.1 on my Windows XP system.   Everything
works as it should - except printing.  I am attempting to use a Xerox
Workcenter Pro 238 on a Microsoft Network.  I have spent hours on the
web looking at all the advice on how to get printing to work.  Nothing
seems to help.  Is there a concise statement of how to make this work
somewhere?  Sure am getting tired of copying out of emacs and pasting
into Notepad just to be able to print.

Thanks,
Steve

^ permalink raw reply	[flat|nested] 119+ messages in thread

end of thread, other threads:[~2006-01-10 10:19 UTC | newest]

Thread overview: 119+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-19 11:18 Printing from WindowXP version of emacs 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
  -- 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  8:45 LENNART BORGMAN
2006-01-04 18:22 ` Eli Zaretskii
2006-01-04 19:14   ` Lennart Borgman
2006-01-05  1:17 ` BRUCE INGALLS
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-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

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