Re: CPU process

"valery_vi" <[email protected]> Tue, 04 Sep 2007 12:07:14 -0000
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
>is there any autoit function can detect if CPU process is becoming to
>0...?
>see attach...
>services is running & using 3% of CPU process...
>i want to write a script to wait until CPU become 0 before >continue...

As you can see 

$array = _ProcessListCPU("", 1000)

for each $i has three members:

$array[$i][0] is cpu %
$array[$i][1] is name
$array[$i][2] is PID

You have to get $i when 

$array[$i][1] = services.exe
; waiting
while $array[$i][0] <> 0 
wend

; services.exe is idle!
<Your code>

Note: $size = $array[0][0] - is count of current processes existed 

Valery

--- In [email protected], "valery_vi" <shehrer1@...> wrote:
>
> It doesn't tested, however:
> 
>
;===============================================================================
> ; Description:      Get process with CPU load and PID, sort them by
> CPU % (highest first)
> ; Parameter(s):     none
> ; Requirement(s):   Win2000/XP
> ; Return Value(s):  A two dimension array (use UBound($Process, 1) to
> get the size)
> ;                    [$i][0] is cpu %
> ;                    [$i][1] is name
> ;                    [$i][2] is PID
> ; Author(s):        Jerome DERN  (jdern "at" free "dot" fr)
> ; Note(s):            none
>
;===============================================================================
> Func SortProcessCPU()
>     $array = _ProcessListCPU("", 1000)
>     $size = $array[0][0]
>     Dim $Process[$size+1][3]
>     $i = 0
>     For $j=1 To $size
>         If $array[$j][0] <> "Idle" And $array[$j][0] <> "System" And
> $array[$j][0] <> "Services"Then
>             $Process[$i][0] = $array[$j][2]
>             $Process[$i][1] = $array[$j][0]
>             $Process[$i][2] = $array[$j][1]
>             $i+=1
>         EndIf
>     Next
>     $size = $i
>     _ArraySort($Process, 1, 0, $size, 3)
>     Return $Process
> EndFunc
> 
>
;===================================================================================================
> 
> Enjoy,
> Valery
> 
> 
> --- In [email protected], aris_azie <no_reply@> wrote:
> >
> > is there any autoit function can detect if CPU process is becoming to 
> > 0...?
> > see attach...
> > services is running & using 3% of CPU process...
> > i want to write a script to wait until CPU become 0 before continue...
> >
>