Re: CPU process

"valery_vi" <[email protected]> Tue, 04 Sep 2007 08:20:32 -0000
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
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...
>