Script Collection
WMI
Printwatcher | Printwatcher |
|
|
|
|
This script watches for activity at the installed printers and writes a logfile. It shows how much a user has printed on wich printer (works also with network printers). But it has a proplem with counting the right amount of printed pages :-( It uses the wmi-class from Tim Golden, which you can download from his webpages. Please put the wmi.py in the same directory where you run this script from. import wmi c = wmi.WMI () print_job_watcher = c.watch_for ( notification_type="Creation", wmi_class="Win32_PrintJob", delay_secs=1 ) while 1: pj = print_job_watcher () print "User %s has submitted %d pages to printer %s" % (pj.Owner, pj.TotalPages, pj.Name) |
|
| Last Updated ( Thursday, 02 February 2006 ) |
| < Prev | Next > |
|---|
Hint: For syntax highlighting and correct Python intendation place your code between html tags <pre> and </pre>.