Jump to content
Sign in to follow this  
m4tek

ProcessGetStats()

Recommended Posts

m4tek

Hey guys,

I want to script a program that's gonna create a txt file with all processes, their PIDs and memory usage. There's no problem with processes and PIDs because ProcessList() uses a 2-dimensional array. ProcessGetStats() uses a mono-dimensional array therefore it can't be listed in the .txt file the same way as ProcessList(). Does anyone have an idea on how to do it? Thanks in advance :)

#include <File.au3>
$file = "processlist.txt"

_FileCreate($file)
FileOpen($file, 1)
$list = ProcessList()
for $i = 1 to $list[0][0]
$pid = $list[$i][1]
$memory = ProcessGetStats($pid)
FileWrite($file, $list[$i][0] & "  " & $list[$i][1] & " " & $memory[0] & @CRLF)
next
Edited by m4tek

Share this post


Link to post
Share on other sites
Andreik

#include <Process.au3>
_RunDOS ("TASKLIST >C:\ProcessList.txt")

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites
m4tek

I forgot about this cmd! Thank you Andreik :)

Now, can anyone solve my problem? I'm interested in fixing the code posted above.

Share this post


Link to post
Share on other sites
m4tek

Very helpful :) Thanks Andreik :(

Edited by m4tek

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.