From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: LENNART BORGMAN Newsgroups: gmane.emacs.help Subject: Re: Printing from WindowXP version of emacs Date: Wed, 04 Jan 2006 09:45:10 +0100 Message-ID: <47f866747f622f.47f622f47f8667@net.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_bX28XnrLn0H3z9AIqj1/xQ)" X-Trace: sea.gmane.org 1136368746 27999 80.91.229.2 (4 Jan 2006 09:59:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2006 09:59:06 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 04 10:59:05 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 1Eu5Q3-0002lN-7C for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2006 10:59:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eu5Rh-00065K-L7 for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2006 05:00:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Eu4IO-0000Al-V9 for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 03:47:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Eu4IM-00008t-9w for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 03:46:59 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eu4IJ-000089-UE for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 03:46:56 -0500 Original-Received: from [130.235.208.46] (helo=piraten.student.lu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Eu4Jg-0004tV-Fk for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 03:48:20 -0500 Original-Received: from net.lu.se (localhost [127.0.0.1]) by piraten.student.lu.se (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003)) with ESMTP id <0ISK007RH8BAPB@piraten.student.lu.se> for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 09:45:10 +0100 (MET) Original-Received: from [212.209.42.132] by piraten.student.lu.se (mshttpd); Wed, 04 Jan 2006 09:45:10 +0100 Original-To: BRUCE INGALLS X-Mailer: iPlanet Messenger Express 5.2 HotFix 1.14 (built Mar 18 2003) Content-language: sv X-Accept-Language: sv Priority: normal 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:32409 Archived-At: This is a multi-part message in MIME format. --Boundary_(ID_bX28XnrLn0H3z9AIqj1/xQ) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline 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
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-lo= ck problem. Clues will be appreciated.

From: E= li 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 n= ame that Emacs
> > can use?
>
> If I run w32prn-custom= ize 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 followin= g 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 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.microso= ft.com/library/default.asp?url=3D/library/en-us/wmisdk/wmi/wmi_tasks__print= ers_and_printing.asp
rem http://msdn.microsoft.com/library/defa= ult.asp?url=3D/library/en-us/wmisdk/wmi/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 Tru= e")
For Each objPrinter in colInstalledPrinters
    Wscript.Echo "Your printer port is"
    If objPrinter.Network then
       Wscript.Echo objPrinter.Name
       Wscript.Echo
       Wscript.Echo "server " + obj= Printer.ServerName
    ElseIf objPrinter.Local then
       Wscript.Echo objPrinter.PortName
       Wscript.Echo
    End If

    Wscript.Echo "shareName " + objPrinter.ShareNa= me
    Wscript.Echo "systemName " + objPrinter.System= Name

    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 &= quot;letter size"
        ElseIf psize =3D 8 then
           Wscript.Echo &= quot;legal size"
        ElseIf psize =3D 19 then
           Wscript.Echo &= quot;A1 size"
        End If
    Next
    For Each paper in objPrinter.PrinterPaperNames
        Wscript.Echo "paper size &q= uot; + paper
    Next

    If not objPrinter.ErrorCleared then
       Wscript.Echo objPrinter.Availability        Wscript.Echo objPrinter.ErrorDescripti= on
    End If
Next

rem --cut-here--
------=_Part_22274_16488965.1136351435778-- --Boundary_(ID_bX28XnrLn0H3z9AIqj1/xQ) MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --Boundary_(ID_bX28XnrLn0H3z9AIqj1/xQ) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --Boundary_(ID_bX28XnrLn0H3z9AIqj1/xQ)--