From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: BRUCE INGALLS Newsgroups: gmane.emacs.help Subject: Re: Printing from WindowXP version of emacs Date: Sat, 7 Jan 2006 00:00:24 -0500 Message-ID: <534d19de0601062100l285844b4w7049252f48ee0ea3@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1136610088 30045 80.91.229.2 (7 Jan 2006 05:01:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 7 Jan 2006 05:01:28 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 07 06:01:27 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ev6Cf-0002jA-QT for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Jan 2006 06:01:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ev6EU-0003EZ-1K for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Jan 2006 00:03:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ev6De-0002uh-UH for help-gnu-emacs@gnu.org; Sat, 07 Jan 2006 00:02:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ev6Db-0002r3-1o for help-gnu-emacs@gnu.org; Sat, 07 Jan 2006 00:02:22 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ev6Da-0002qz-VW for help-gnu-emacs@gnu.org; Sat, 07 Jan 2006 00:02:19 -0500 Original-Received: from [64.233.184.197] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ev6FS-0008Dv-Pm for help-gnu-emacs@gnu.org; Sat, 07 Jan 2006 00:04:14 -0500 Original-Received: by wproxy.gmail.com with SMTP id i27so2492154wra for ; Fri, 06 Jan 2006 21:00:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=uW5pDrNvxlOOYlAFWIXGfdMBm1OJD8Hgk6KiLXIwlW6od/enP/t85BGJrWlvjHvkqldH7ILGplLDRjdyJ3I1jhZIhF+CXVRydsZJkXtRBBSHfwcl9ntzJFywSeXIWNi1ZcoKszZrqZzUnYRrKw9W6voOn/b9UVJ35YbYba1eR3s= Original-Received: by 10.54.86.5 with SMTP id j5mr1076085wrb; Fri, 06 Jan 2006 21:00:24 -0800 (PST) Original-Received: by 10.54.127.3 with HTTP; Fri, 6 Jan 2006 21:00:24 -0800 (PST) Original-To: help-gnu-emacs@gnu.org Content-Disposition: inline X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:32520 Archived-At: > > 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 =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") 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 frien= ds. 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?