Control Printer Queue On Windows 2000/XP

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Jun 30 06:42:03 EDT 2005


[binarystar]
| Hi folks,
| 
| I am writing a script to print a few thousand pdf documents and I need
| to have some control over the number of jobs that are sent to the
| printer queue at time ... something along the lines of
| 
| if number_jobs > MAX_JOBS:
|     time.sleep(10)
| else:
|     #Print More Files
| 
| 
| I have been investigating the win32print utility
| http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/pywin32
| /win32print.html
| 
| ... but can not see how to get print queue information eg the 
| number of
| jobs pending .. atleast my attempts are failing

Assuming I understand the need, you can do something like
this with WMI:

<code>
import wmi

c = wmi.WMI ()
print len (c.Win32_PrintJob ())

</code>

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list