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)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.