tcox8 Posted August 17, 2008 Posted August 17, 2008 hey guys, I was wondering if there was any way to use autoit to determine if there is a print job sent to Window's print queue. What I have are three monitors hooked to one computer. On all three monitors there will be three different print queues to three different printers. When there are no print jobs happening I need there to be three different things going on the monitors(i.e. CNN's headlines on one screen, the weather webpage on another, etc.). That isn't the hard part. However, what I need is when there is a print job detected then that monitor will show the print queue to the printer that received the print job and the other monitors will still show the web pages. Maybe what I need is a pixelsearch or pixelchecksum that can work for inactive windows? I read that it's possible to do this but I can't figure out how nor can I find any examples of it working in an unactive window. Any ideas? thanks in advance! "There are only 10 types of people in the world: Those who understand binary, and those who don't"
martin Posted August 17, 2008 Posted August 17, 2008 hey guys, I was wondering if there was any way to use autoit to determine if there is a print job sent to Window's print queue. What I have are three monitors hooked to one computer. On all three monitors there will be three different print queues to three different printers. When there are no print jobs happening I need there to be three different things going on the monitors(i.e. CNN's headlines on one screen, the weather webpage on another, etc.). That isn't the hard part. However, what I need is when there is a print job detected then that monitor will show the print queue to the printer that received the print job and the other monitors will still show the web pages.Maybe what I need is a pixelsearch or pixelchecksum that can work for inactive windows? I read that it's possible to do this but I can't figure out how nor can I find any examples of it working in an unactive window. Any ideas? thanks in advance!One way to find out if there are any print jobs queued for a particular printer is to use the GetPrinter API with the level parameter set to 2. The returned PRINTER_INFO_2 structure has an element which holds the number of print jobs queued for that printer. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
tcox8 Posted August 18, 2008 Author Posted August 18, 2008 One way to find out if there are any print jobs queued for a particular printer is to use the GetPrinter API with the level parameter set to 2. The returned PRINTER_INFO_2 structure has an element which holds the number of print jobs queued for that printer.Thanks for your fast reply! I tried your solution however I can't find any documentation on the GetPrinter API in the autoit help file. Is there something else I'm missing? "There are only 10 types of people in the world: Those who understand binary, and those who don't"
ptrex Posted August 18, 2008 Posted August 18, 2008 @tcox8 maybe this can get you going. Dim $intTotalJobs, $intTotalPages, $intMaxPrintJob $strComputer = "." $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colPrintJobs = $objWMIService.ExecQuery ("Select * from Win32_PrintJob") For $objPrintJob in $colPrintJobs $intTotalJobs = $intTotalJobs + 1 $intTotalPages = $intTotalPages + $objPrintJob.TotalPages If $objPrintJob.TotalPages > $intMaxPrintJob Then $intMaxPrintJob = $objPrintJob.TotalPages EndIf Next ConsoleWrite("Total print jobs in queue: " & $intTotalJobs & @CRLF) ConsoleWrite( "Total pages in queue: " & $intTotalPages & @CRLF) ConsoleWrite( "Largest print job in queue: " & $intMaxPrintJob & @CRLF) regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
tcox8 Posted August 18, 2008 Author Posted August 18, 2008 @tcox8 maybe this can get you going. Dim $intTotalJobs, $intTotalPages, $intMaxPrintJob $strComputer = "." $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colPrintJobs = $objWMIService.ExecQuery ("Select * from Win32_PrintJob") For $objPrintJob in $colPrintJobs $intTotalJobs = $intTotalJobs + 1 $intTotalPages = $intTotalPages + $objPrintJob.TotalPages If $objPrintJob.TotalPages > $intMaxPrintJob Then $intMaxPrintJob = $objPrintJob.TotalPages EndIf Next ConsoleWrite("Total print jobs in queue: " & $intTotalJobs & @CRLF) ConsoleWrite( "Total pages in queue: " & $intTotalPages & @CRLF) ConsoleWrite( "Largest print job in queue: " & $intMaxPrintJob & @CRLF) regards, ptrex Thanks for your replies guys! You help is greatly appreciated :-) "There are only 10 types of people in the world: Those who understand binary, and those who don't"
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