ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activeperl
activeperl

by VDI Freemail other posts by this author
May 8 2008 1:48AM messages near this date
| Finding a printer; need help
Deane,

try 

 

# Printer_available.pl listet alle verfügbaren Drucker und die
 dazugehörigen

# Ports auf den aktuellen Rechner

 

use Printer;

$prn = new Printer('linux' =>  'lp',

                   'MSWin32' =>  'LPT1',

                   $OSNAME =>  'Printer');

%available_printers = $prn-> list_printers;

 

print "Verfügbare Drucker\n";

printf ("%3s %40s\t%s\n", 'Nr.', 'Name', 'Port');

print "-" x 70, "\n";

 

foreach $i (0 .. $#{$available_printers{'name'}})

  {printf ("%3d %40s\t", $i, $available_printers{'name'}[$i]);

   print "$available_printers{'port'}[$i]\n";

  }

 

Generates the output

 

Verfügbare Drucker

Nr.                                              Name     Port

-------------------------------------------------------------------------------------------

  0                                                  A3H    
 EG_Olivetti_D300_30.0.0.87

  1                                                  A4H    
 EDV_IP_30.0.0.249

  2        Color LaserJet 4500 PCL Vertrieb    
 COLOR_Vertrieb_IP_30.0.0.220

  3                      DesignJet 800 24 by HP    
 Farbe_TB_30.0.0.126

  4    EDV HP LaserJet 1015 PCL 5e lokal     EDV_IP_30.0.0.249

  5                  EG_Olivetti d-Copia 300 KX    
 EG_Olivetti_D300_30.0.0.87

  6                                              FinePrint    FPR5:

  7 Microsoft Office Document Image Writer    Microsoft Document
 Imaging Writer Port:

  8                    OG_Kyocera KM-3050 KX    OG_Kyocera_30.0.0.88

 9                                          PDFCreator    PDFCreator:

 

If you have problems like this

 

Can't locate Printer.pm in @INC (@INC contains: C:/Perl/site/lib
 C:/Perl/lib .)

at d:\Help\perl\Printer_available.pl line 4.

BEGIN failed--compilation aborted at d:\Help\perl\Printer_available.pl
 line 4.

 

copy printer.pm from C:\Perl\site\lib to C:\Perl\site\lib\win32 after
 installing Printer-0.98.zip

 

Manfred

 



_______________________________________________
ActivePerl mailing list
ActivePerl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved