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: Wed, 4 Jan 2006 00:10:35 -0500 Message-ID: <534d19de0601032110j2155de41qf2c9f3d62e80a594@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0457662713==" X-Trace: sea.gmane.org 1136351456 18439 80.91.229.2 (4 Jan 2006 05:10:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2006 05:10:56 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 04 06:10:55 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 1Eu0v9-00027P-9j for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2006 06:10:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eu0wo-0005sv-1z for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2006 00:12:30 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Eu0wg-0005so-3I for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 00:12:22 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Eu0wf-0005sZ-92 for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 00:12:21 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eu0wf-0005sW-6C for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 00:12:21 -0500 Original-Received: from [64.233.184.205] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Eu0y0-0001Zj-3N for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 00:13:44 -0500 Original-Received: by wproxy.gmail.com with SMTP id i30so592951wra for ; Tue, 03 Jan 2006 21:10:36 -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; b=iChd9BruTGvaFvH42GjdwpVsaIUTamdBtIorCCPr74F3V+E6AcAwHIQ7v7wKNP06b1mECNqzZXZzevCM95RePP+QcZXypLt+NIPv3b66Fn32alvDVt24eU3MKnq2n9eZiaSBjXO3doepCQW+nWS4d4f6s28PSEp7PPNI1+ZOlVI= Original-Received: by 10.54.114.4 with SMTP id m4mr2152617wrc; Tue, 03 Jan 2006 21:10:35 -0800 (PST) Original-Received: by 10.54.127.3 with HTTP; Tue, 3 Jan 2006 21:10:35 -0800 (PST) Original-To: help-gnu-emacs@gnu.org 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:32408 Archived-At: --===============0457662713== 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-- --===============0457662713== 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 --===============0457662713==--