masvil Posted January 26, 2006 Posted January 26, 2006 How can I detect if printer is printing a file?
Developers Jos Posted January 26, 2006 Developers Posted January 26, 2006 How can I detect if printer is printing a file?something like this: $intPrinters = 1 $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Printer") For $objItem In $colItems MsgBox(0,"Printer Info","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 ) $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.
masvil Posted January 26, 2006 Author Posted January 26, 2006 (edited) "Printer State: " & $objItem.PrinterState & @LF & _ Good, Thanx. When printer is printing then it go from 3 to 4. Any way to see the filename? Edited January 26, 2006 by masvil
arcker Posted March 2, 2006 Posted March 2, 2006 i'm working on it to see the filename, you need to retrieve information about jobs of the printer i have integrated this function in my admin tool let's take a look when i will publish it -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
strate Posted March 6, 2006 Posted March 6, 2006 (edited) $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") $colInstalledPrinters = $objWMIService.ExecQuery("Select * from Win32_PrintJob Where Document <> ''") MsgBox(262144,'Debug line ~38','Selection:' & @lf & '$colInstalledPrinters' & @lf & @lf & 'Return:' & @lf & $colInstalledPrinters & @lf & @lf & '@Error:' & @lf & @Error);### Debug MSGBOX For $objPrinter in $colInstalledPrinters MsgBox(0,'',$objPrinter.Document) Next When this is ran and no documents are printing what does the $colInstalledPrinters consist of? I want to make is so that it will alert the user that nothing is in process. By the way this is my first time doing anything like this..... Could some of this be wrote better? Edited March 6, 2006 by strate INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
strate Posted March 6, 2006 Posted March 6, 2006 Nobody... Is it an array? INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Zedna Posted April 30, 2006 Posted April 30, 2006 Nobody... Is it an array?I don't know but try: IsObj() or @error ... Resources UDF ResourcesEx UDF AutoIt Forum Search
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