Jump to content

ProcessGetStats()


Recommended Posts

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...