Printer name and status

(imported topic written by ebibibi91)

I would like to get imformation about printer name and it’s status.

Now, I use relevance below.

Q: if (exists wmi) then (string values of selects “caption, printerstatus from win32_printer” of wmi) else (“N/A”)

A: Printer1

A: 3

A: Printer2

A: 3

printerstatus of ‘3’ means ‘idle’.

http://msdn2.microsoft.com/en-us/library/aa394363(VS.85).aspx

Then, I want to get result like below.

A: Printer1, Idle

A: Printer2, Idle

How can I do?

Any help is appreciated. Thanks.

(imported comment written by BenKus)

Hello ebibibi,

You can do something like this:

(item 0 of it, item 1 of it) of (string values of property “Caption” of it, (if (it=“1”) then “Other” else if (it=“2”) then “Unknown” else if (it=“3”) then “Idle” else if (it=“4”) then “Printing” else if (it=“5”) then “Warming Up” else if (it=“6”) then “Stopped Printing” else if (it=“7”) then “Offline” else if (it=“8”) then “Paused” else if (it=“9”) then “Error” else if (it=“10”) then “Busy” else if (it=“11”) then “Not Available” else if (it=“12”) then “Waiting” else if (it=“13”) then “Processing” else if (it=“14”) then “Initialization” else if (it=“15”) then “Power Save” else if (it=“16”) then “Pending Deletion” else if (it=“17”) then “I/O Active” else if (it=“18”) then “Manual Feed” else “unknown”) of string values of property “printerstatus” of it) of (select objects “caption, printerstatus from win32_printer” of wmi)

Note that if you have network printers, I think this query might take a while (a few seconds)…

Ben

(imported comment written by ebibibi91)

Mr. Ben Kus.

Thank you for your very quick reply. I got perfect result, I wanted!