Jump to content

Knowing if a new process starts


Recommended Posts

I am attempting to put together something that would know if a new process starts. One problem is that I can't know ahead of time how many processes will be running and the array is going out of bounds.

Any ideas on how to handle this?

CODE
; List all processes

$list = ProcessList()

$temp=0

While $temp<10

CheckProcesses()

sleep(1000)

$temp=$temp+1

WEnd

Func CheckProcesses()

$currentProcesses=ProcessList()

for $i = 1 to $currentProcesses[0][0]

; if Not $list[$i][0] == null

If Not($currentProcesses[$i][0] == $list[$i][0]) Then ; check to see if saved processes are different

msgbox(0, "",$list[$i][0] & "is different")

$list=$currentProcesses

EndIf

next

EndFunc

Link to comment
Share on other sites

Check out _ArrayAdd in the help file, I use it all the time :)

Edit: Now I see where your problem is, it's in the beginning of your for loop, here's how it should look

For $i=1 To $currentProcesses[0][0]-1
Edited by monoceres

Broken link? PM me and I'll send you the file!

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...