Sign in to follow this  
Followers 0
jruelan

Printer

14 posts in this topic

hello, how do i know if the printer printed the second copy of 5 copies, the third of five copies, and so on... tnx...

Share this post


Link to post
Share on other sites



hello, how do i know if the printer printed the second copy of 5 copies, the third of five copies, and so on... tnx...

From the command line you can just type NET PRINT for some info. Don't remember if pages for active jobs are listed.

Can you work with WMI COM objects? I ask because that is in the Win32_PrintJob object as PagesPrinted and TotalPages for the job. If you have Microsoft's Scriptomatic, just find the VBScript enumerator for Win32_PrintJob and convert what you need to AutoIt.

Merry Christmas!

:)


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

Share this post


Link to post
Share on other sites

tnx for the wonderful reply, uhm, where can i find the scriptomatic??? : )

Merry Christmas too!

Share this post


Link to post
Share on other sites

oops, found it already, tnx... wonderful help anyways....

Share this post


Link to post
Share on other sites

From the command line you can just type NET PRINT for some info. Don't remember if pages for active jobs are listed.

Can you work with WMI COM objects? I ask because that is in the Win32_PrintJob object as PagesPrinted and TotalPages for the job. If you have Microsoft's Scriptomatic, just find the VBScript enumerator for Win32_PrintJob and convert what you need to AutoIt.

Merry Christmas!

:)

Or use the AutoIt Scriptomatic and not have to convert

; Generated by AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output &= "Computer: " & $strComputer  & @CRLF
$Output &= "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PrintJob", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output &= "Caption: " & $objItem.Caption & @CRLF
      $Output &= "DataType: " & $objItem.DataType & @CRLF
      $Output &= "Description: " & $objItem.Description & @CRLF
      $Output &= "Document: " & $objItem.Document & @CRLF
      $Output &= "DriverName: " & $objItem.DriverName & @CRLF
      $Output &= "ElapsedTime: " & WMIDateStringToDate($objItem.ElapsedTime) & @CRLF
      $Output &= "HostPrintQueue: " & $objItem.HostPrintQueue & @CRLF
      $Output &= "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
      $Output &= "JobId: " & $objItem.JobId & @CRLF
      $Output &= "JobStatus: " & $objItem.JobStatus & @CRLF
      $Output &= "Name: " & $objItem.Name & @CRLF
      $Output &= "Notify: " & $objItem.Notify & @CRLF
      $Output &= "Owner: " & $objItem.Owner & @CRLF
      $Output &= "PagesPrinted: " & $objItem.PagesPrinted & @CRLF
      $Output &= "Parameters: " & $objItem.Parameters & @CRLF
      $Output &= "PrintProcessor: " & $objItem.PrintProcessor & @CRLF
      $Output &= "Priority: " & $objItem.Priority & @CRLF
      $Output &= "Size: " & $objItem.Size & @CRLF
      $Output &= "StartTime: " & WMIDateStringToDate($objItem.StartTime) & @CRLF
      $Output &= "Status: " & $objItem.Status & @CRLF
      $Output &= "StatusMask: " & $objItem.StatusMask & @CRLF
      $Output &= "TimeSubmitted: " & WMIDateStringToDate($objItem.TimeSubmitted) & @CRLF
      $Output &= "TotalPages: " & $objItem.TotalPages & @CRLF
      $Output &= "UntilTime: " & WMIDateStringToDate($objItem.UntilTime) & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_PrintJob" )
Endif


Func WMIDateStringToDate($dtmDate)

    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

where can i download this?

Tnx!

Happy Holidays!

Share this post


Link to post
Share on other sites

where can i download this?

Tnx!

Happy Holidays!

The original is in Example scripts (way back) but I did a couple of mods so it would run compiled.

Here is the link to the compiled version

AutoIt Scriptomatic.

Good luck.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

cool!!! tnx alot there!

Share this post


Link to post
Share on other sites

can it run on Win2003 ?


Call me "Queen of Pain" :)

Share this post


Link to post
Share on other sites

can it run on Win2003 ?

I don't see why not.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

scriptomatic is great but does any one know how to detect if the printer has finished printing a single page. Win32_PrintJob only displays the pages to be printed, not "Now printing 5 of 13 pages" and the like...

tnx, anyone

Share this post


Link to post
Share on other sites

scriptomatic is great but does any one know how to detect if the printer has finished printing a single page. Win32_PrintJob only displays the pages to be printed, not "Now printing 5 of 13 pages" and the like...

tnx, anyone

Did you compare the $objItem.PagesPrinted and $objItem.TotalPages properties?

:)


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

Share this post


Link to post
Share on other sites

scriptomatic is great but does any one know how to detect if the printer has finished printing a single page. Win32_PrintJob only displays the pages to be printed, not "Now printing 5 of 13 pages" and the like...

tnx, anyone

I'm not sure if "ExtendedPrinterStatus: " & $objItem.ExtendedPrinterStatus gives it to you or not but you can also try looking up

Win32_PrintJob

with Scriptomatic

I'm sure it has Status.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

i've already compared $objItem.PagesPrinted and $objItem.TotalPages properties. I am printing a 2 page pdf document, i want to reproduce five copies of it, ergo, i placed 5 in the Copies control. during the printer spooling, i ran the scriptomatic win32_printjob and found out the pagesprinted outputs 10 while total pages is 0, i tried rerunning the win32_printjob query until the printing is finished, all the outputs of the query are the same

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0