pintas Posted June 26, 2019 Posted June 26, 2019 (edited) I've started playing with Scriptomatic to understand a bit more of WMi Classes and how to use them. My focus is to make a print logger/counter script. So basically i use the script below and print some pages. But when i do, the TotalPages value is always wrong. I've searched the forum to see if i could find a way to correct this, but without luck... $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") While 1 $AllPrintJobs = $objWMIService.ExecQuery ("SELECT * FROM Win32_PrintJob") For $PrintJob In $AllPrintJobs ConsoleWrite($PrintJob.TotalPages & @CRLF) Next Sleep(500) WEnd Any idea how to monitor printed pages in real time and count them? Thanks! Edited June 26, 2019 by pintas
TheXman Posted June 26, 2019 Posted June 26, 2019 4 hours ago, pintas said: But when i do, the TotalPages value is always wrong. Without any details as to what is wrong with the TotalPages property's value, the quoted statement above is almost totally useless in terms of trying to get help trouble shooting your issue. Does the TotalPages value always show zero? Does it always show a few pages more than expected? Does it always show a few pages less than expected? What, specifically, is "always wrong" with the TotalPages value? In case you weren't aware, you can read more about the Win32_PrintJob class class HERE. If the issue with the value is that it is zero when you think it shouldn't be, then as it says on the page that I referenced, "This value may be 0 (zero) if the print job does not contain page-delimiting information.". If that isn't the issue, then you need to provide more details. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
pintas Posted June 27, 2019 Author Posted June 27, 2019 (edited) 16 hours ago, TheXman said: Without any details as to what is wrong with the TotalPages property's value, the quoted statement above is almost totally useless in terms of trying to get help trouble shooting your issue. Does the TotalPages value always show zero? Does it always show a few pages more than expected? Does it always show a few pages less than expected? What, specifically, is "always wrong" with the TotalPages value? In case you weren't aware, you can read more about the Win32_PrintJob class class HERE. If the issue with the value is that it is zero when you think it shouldn't be, then as it says on the page that I referenced, "This value may be 0 (zero) if the print job does not contain page-delimiting information.". If that isn't the issue, then you need to provide more details. Always wrong meaning it shows zero sometimes when i print one or more copies, or it shows 1 sometimes when i print more than one copies. It never shows the correct number of printed paper sheets. Hence... always wrong. What does it mean to 'contain page-delimiting information'? If i print something on notepad, does that contain page-delimiting info? Is there another way to monitor printed copies? Edited June 27, 2019 by pintas
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