From: hellpenny@gmail.com on 30 Sep 2005 16:08 Can someone post a url or complete list of info items available (from VB script) for objWMIService.ExecQuery ("Select * from Win32_PrintJob") ? I'm trying to determine the time a job BEGAN <i>printing</i> .. not what time it was submitted. I have a script that raises an alert when a job hasn't printed for 15 minutes since the Submit time but if there are Several pending jobs I don't want them to alert ... only if they are the currently printing (or stuck) job. Looking for something like "objPrinter.TimeStarted" to compare against (as opposed to "TimeSubmitted") ... Here is the code snippet I'm working from: '---------- 'Identifies any print jobs that have been in the print queue for more than 15 minutes. Const USE_LOCAL_TIME = True Set DateTime = CreateObject("WbemScripting.SWbemDateTime") strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colInstalledPrinters = objWMIService.ExecQuery _ ("Select * from Win32_PrintJob") Wscript.Echo "Print Queue, Job ID, TimeSubmitted, Total Pages" For Each objPrinter in colInstalledPrinters DateTime.Value = objPrinter.Submitted dtmActualTime = DateTime.GetVarDate(USE_LOCAL_TIME) TimeinQueue = DateDiff("n", dtmActualTime, Now) If TimeinQueue > 15 Then strPrinterName = Split(objPrinter.Name,",",-1,1) Wscript.Echo strPrinterName(0) & ", " _ & objPrinter.JobID & ", " & dtmActualTime & ", " & _ objPrinter.TotalPages End If Next '--------- Regards, -demijohn
From: Norm Cook on 1 Oct 2005 09:54 Perhaps you want StartTime http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_printjob.asp <hellpenny(a)gmail.com> wrote in message news:1128110904.153832.166470(a)o13g2000cwo.googlegroups.com... > Can someone post a url or complete list of info items available (from > VB script) for objWMIService.ExecQuery ("Select * from Win32_PrintJob") > ? > > I'm trying to determine the time a job BEGAN <i>printing</i> .. not > what time it was submitted. I have a script that raises an alert > when a job hasn't printed for 15 minutes since the Submit time but > if there are Several pending jobs I don't want them to alert ... only > if they are the currently printing (or stuck) job. > > Looking for something like "objPrinter.TimeStarted" to compare against > (as opposed to "TimeSubmitted") ... > > Here is the code snippet I'm working from: > > '---------- > 'Identifies any print jobs that have been in the print queue for more > than 15 minutes. > > Const USE_LOCAL_TIME = True > Set DateTime = CreateObject("WbemScripting.SWbemDateTime") > strComputer = "." > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & strComputer & > "\root\cimv2") > Set colInstalledPrinters = objWMIService.ExecQuery _ > ("Select * from Win32_PrintJob") > Wscript.Echo "Print Queue, Job ID, TimeSubmitted, Total Pages" > For Each objPrinter in colInstalledPrinters > DateTime.Value = objPrinter.Submitted > dtmActualTime = DateTime.GetVarDate(USE_LOCAL_TIME) > TimeinQueue = DateDiff("n", dtmActualTime, Now) > If TimeinQueue > 15 Then > strPrinterName = Split(objPrinter.Name,",",-1,1) > Wscript.Echo strPrinterName(0) & ", " _ > & objPrinter.JobID & ", " & dtmActualTime & ", " & _ > objPrinter.TotalPages > End If > Next > > '--------- > > Regards, > > -demijohn >
From: hellpenny@gmail.com on 3 Oct 2005 10:48 StartTime - Date and time that the job begins. What I want is a date stamp telling me when a currently printing job *began printing* not when it _will begin_ ... Plus, I believe StartTime is associated with the Queue object, not the Printjob. Anyway, I get a 'type mismatch' when I try using it in place of TimeSubmitted as in: DateTime.Value = objPrinter.TimeSubmitted replaced by DateTime.Value = objPrinter.StartTime
From: hellpenny@gmail.com on 3 Oct 2005 11:36 Norm, Reviewed the documentation link you sited .. doesn't look like there is a field defined for what I want. Thanks for trying. Here is the scenario I'm trying to avoid (maybe I can find some other way around it): 1. a job is hanging in the queue for, say, an hour or more 2. several jobs, say 30, pile up behind 3. an alert is sent for the first job (since current time minus time submitted > 15 minutes) 4. after the initial problem job (Job A) is resolved, the next pending job (Job B) begins printing ... next time the monitor script runs, assuming Job B hasn't completed it could trigger a false alarm (since time submitted is being subtracted from current time rather than the Job B's **actual** begin time being subtracted from current time) ... In theory this could cause all subsequent jobs to alarm as each one prints (it's unlikely unless these are Huge jobs or my monitor loop "sleep time" is very small) but I'd like each job to be considered on its own merits without the previous Job's delay factored in.
|
Pages: 1 Prev: Error C1083 Next: Late bound events C# server, vb6 client |