flyingboz Posted December 18, 2010 Share Posted December 18, 2010 Have a need to monitor printer queue status, such that I don't perform a new task until the document last printed has completed. Ideally, I'd like to be able to 1) enumerate the printer list, seeing how many jobs there are currently in queue 2) determine printer status -- at least functional / non 3) delete individual jobs. I need the methods to work at least from xp to win7, and preferably would include w2k server. TIA Only reference in the forums in my pre-post searches was dealing with the printui user interface, I need to hide all that from the user. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 18, 2010 Developers Share Posted December 18, 2010 Maybe something to look at: expandcollapse popup$intPrinters = 1 $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Printer") For $objItem In $colItems if $objItem.Queued > 0 or $objItem.PrinterStatus <> 3 or $objItem.PrinterState <> 0 Then ConsoleWrite("Printers on " _ & $objItem.name & ", Printer Number: " & $intPrinters & @LF & _ "====================================" & @LF & _ "Availability: " & $objItem.Availability & @LF & _ "Description: " & $objItem.Description & @LF & _ "Printer: " & $objItem.DeviceID & @LF & _ "Driver Name: " & $objItem.DriverName & @LF & _ "Port Name: " & $objItem.PortName & @LF & _ "Printer State: " & $objItem.PrinterState & @LF & _ "Printer Status: " & $objItem.PrinterStatus & @LF & _ "PrintJobDataType: " & $objItem.PrintJobDataType & @LF & _ "Print Processor: " & $objItem.PrintProcessor & @LF & _ "Spool Enabled: " & $objItem.SpoolEnabled & @LF & _ "Separator File: " & $objItem.SeparatorFile & @LF & _ "Queued: " & $objItem.Queued & @LF & _ "Status: " & $objItem.Status & @LF & _ "StatusInfo: " & $objItem.StatusInfo & @LF & _ "Published: " & $objItem.Published & @LF & _ "Shared: " & $objItem.Shared & @LF & _ "ShareName: " & $objItem.ShareName & @LF & _ "Direct: " & $objItem.Direct & @LF & _ "Location: " & $objItem.Location & @LF & _ "Priority: " & $objItem.Priority & @LF & _ "Work Offline: " & $objItem.WorkOffline & @LF & _ "Horizontal Res: " & $objItem.HorizontalResolution & @LF & _ "Vertical Res: " & $objItem.VerticalResolution ) ConsoleWrite(@lf & "************************************************************************************" & @lf) EndIf $intPrinters = $intPrinters + 1 Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Lemures Posted February 18, 2011 Share Posted February 18, 2011 Maybe something to look at: expandcollapse popup$intPrinters = 1 $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Printer") For $objItem In $colItems if $objItem.Queued > 0 or $objItem.PrinterStatus <> 3 or $objItem.PrinterState <> 0 Then ConsoleWrite("Printers on " _ & $objItem.name & ", Printer Number: " & $intPrinters & @LF & _ "====================================" & @LF & _ "Availability: " & $objItem.Availability & @LF & _ "Description: " & $objItem.Description & @LF & _ "Printer: " & $objItem.DeviceID & @LF & _ "Driver Name: " & $objItem.DriverName & @LF & _ "Port Name: " & $objItem.PortName & @LF & _ "Printer State: " & $objItem.PrinterState & @LF & _ "Printer Status: " & $objItem.PrinterStatus & @LF & _ "PrintJobDataType: " & $objItem.PrintJobDataType & @LF & _ "Print Processor: " & $objItem.PrintProcessor & @LF & _ "Spool Enabled: " & $objItem.SpoolEnabled & @LF & _ "Separator File: " & $objItem.SeparatorFile & @LF & _ "Queued: " & $objItem.Queued & @LF & _ "Status: " & $objItem.Status & @LF & _ "StatusInfo: " & $objItem.StatusInfo & @LF & _ "Published: " & $objItem.Published & @LF & _ "Shared: " & $objItem.Shared & @LF & _ "ShareName: " & $objItem.ShareName & @LF & _ "Direct: " & $objItem.Direct & @LF & _ "Location: " & $objItem.Location & @LF & _ "Priority: " & $objItem.Priority & @LF & _ "Work Offline: " & $objItem.WorkOffline & @LF & _ "Horizontal Res: " & $objItem.HorizontalResolution & @LF & _ "Vertical Res: " & $objItem.VerticalResolution ) ConsoleWrite(@lf & "************************************************************************************" & @lf) EndIf $intPrinters = $intPrinters + 1 Next I'm unable to get this working. When I run this code, it doesn't do anything. Any ideas? (Win7) Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 18, 2011 Share Posted February 18, 2011 Jos' demo ran fine for me on Vista Business 32bit. You might want to comment out his If/EndIf lines to see all printers regardless of status, then decide how to filter later. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Lemures Posted February 21, 2011 Share Posted February 21, 2011 (edited) Ah hah! I'm an idiot, I was doing something so stupid that I'm embarrassed to even admit it, lol. It is working now. Thanks! Edited February 21, 2011 by Lemures Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now