Alec Bennett wrote:
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.
Generally, altho' not always, questions like this have an answer
which starts with "WMI". In this case I'm not absolutely convinced,
but it looks quite good. Guessing that the Win32_Printer class is
what you want leads to this:
http://msdn.microsoft.com/en-us/library/aa394363(VS.85).aspx
and the PrinterStatus or ExtendedPrinterStatus attributes which
looks handy. So...
<code>
import wmi
c = wmi.WMI ()
for p in c.Win32_Printer ():
print p.Caption, p.Printerstatus
</code>
Frankly I've no idea if it's any more or less reliable than your
other method; maybe someone who's done more printer-related work
can chip in here. But it at least opens an alternative avenue
for you to look at.
TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32