I'm having trouble getting the printer status in Windows. Ideally I'd like to
get the info contained in the "Status" column when you open a printer from the
Windows control panel --> printers.
I've been using the routine pasted at the end of this email, which works for
some printers, but not others. All I really need is the info in that window
that opens when you click a printer in Windows control panel --> printers,
under status. Does anyone know how to get this?
Here's the win32print routine I'm using.
import win32print
printer_name = "Sony UP-DR150"
s = win32print.OpenPrinter(printer_name)
# List the printer's jobs (in range 0 to 999):
raw = win32print.EnumJobs(s, 0, 999)
# If there are any jobs, lets analyze them:
if len(raw) > 0:
results = raw[0]
print results
win32print.ClosePrinter(s)
'''
{'Status': 1, 'pPrinterName': 'Sony UP-DR150', 'pDocument':
'C:\\photoboof\\strips\\104375.jpg', 'Submitted': <PyTime:4/20/2009 2:32:57
PM>, 'JobId': 31, 'Priority': 1, 'pUserName': 'Administrator', 'pStatus': None,
'PagesPrinted': 0, 'Position': 1, 'TotalPages': 0, 'pDatatype': 'RAW',
'pMachineName': '\\\\ASDF'}
'''
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32