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

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




reply via email to

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