lnx2050 Posted April 20, 2005 Share Posted April 20, 2005 helloooooo,fist, great thanks for this super tools which is autoit !ProcessList can extract le PID and the Name of process,but i would like to extract the time CPU and memory of process running; List just NTbackup.exe processes $list = ProcessList("ntbackup.exe") for $i = 1 to $list[0][0] msgbox(0, $list[$i][0], $list[$i][1]) nexthave a idea ?thanks a lot.Ln. Link to comment Share on other sites More sharing options...
sylvanie Posted April 20, 2005 Share Posted April 20, 2005 Hello, You can use the command line pslist, from the pstools (www.sysinternals.com) You'll redirect the output in a file, and you'll extract the informations. Link to comment Share on other sites More sharing options...
lnx2050 Posted April 21, 2005 Author Share Posted April 21, 2005 hello, i've tried pslist.exe. one time it works good, next time not, next good, next not .....dont know why ... a part of scripts : echo Liste des Process actifs>> %ROOTAIL%\%COMPUTERNAME% start /wait %ROOTAIL%\OUTILS\pslist.exe>>%ROOTAIL%\%COMPUTERNAME% Ln Link to comment Share on other sites More sharing options...
sylvanie Posted April 21, 2005 Share Posted April 21, 2005 Hello, try with this script : include <file.au3> #include <array.au3> dim $process[4]; process will contain the name proceess, the pid, the cpu time and memory $tmp1=@TempDir&"\tmplist.txt" $tmp2=@TempDir&"\tmpmem.txt" Do runwait(@comspec&' /c pslist | find " " | find ":" | sort > '&$tmp1,"",@SW_HIDE) runwait(@comspec&' /c pslist -m | find " " | find /V "Priv Pk" | sort > '&$tmp2,"",@SW_HIDE) $fic1=FileOpen($tmp1,0) $fic2=FileOpen($tmp2,0) if $fic1=-1 or $fic2=-1 Then MsgBox(16,"files can not be read",1) return -1 EndIf $nbproc=_FileCountLines($tmp1) $nbproc2=_FileCountLines($tmp2) Until $nbproc=$nbproc2 ; sometimes 1 process is closed or is launched between 2 call of pslist DIM $ArrayProc[$nbproc]; big array which contains all array of type $process $line1="" for $cpt=0 to $nbproc-1 $line1=FileReadLine($fic1) $line1=StringStripWS($line1,4) $line1=StringSplit($line1," ",1) $line2=FileReadLine($fic2) $line2=StringStripWS($line2,4) ;MsgBox(0,"debug",$line2) $line2=StringSplit($line2," ",1) $process[0]=$line1[1];name $process[1]=$line1[2];pid $process[2]=$line1[7];cpu time $process[3]=$line2[4];memory $ArrayProc[$cpt]=$process Next For $cpt=0 to $nbproc-1 _ArrayDisplay($ArrayProc[$cpt],"test") Next Link to comment Share on other sites More sharing options...
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