Sign in to follow this  
Followers 0
Valik

Enumerating Processes - Revisited

5 posts in this topic

Jon, since you rejected the first enumeration method I submitted, I've decided to try a different approach.

Since PID's are now accepted in all the process functions, ProcessEnumerate() could return an array of every PID in the system. Then, in order to find the name, an additional function could be added which returns the name of a process based on its PID. Some example code might look like:

$pids = ProcessEnumerate()
For $i = 1 To $pids[0]
    If ProcessName($pids[$i]) = "notepad.exe" Then
       ; Do something
     EndIf
Next

Would this be a better fit?

Share this post


Link to post
Share on other sites



Yeah, I like that.

Maybe a optional parameter for Enumerate too that can specifiy what is returned - names or pids.

And maybe a general conversion pid <-> name function. If the parameter is a number then assume pid and return name, if the parameter is a string then assume name and return pid. Or something?

I intend to do something similar for window titles too.

Share this post


Link to post
Share on other sites

Both of those sound good, Jon. I'll incoporate both of those ideas.

Share this post


Link to post
Share on other sites

So we'll can make a 100% autoit task manager :ph34r:

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  
Followers 0