Jump to content

WinActivate via PID?


Recommended Posts

Hiya! I just stumbled across this language and it caught my eye. I'm new to it so bear with me ;)

Is there any way to preform a function along the lines of "WinActivate", like possibly a "ProcessActivate" function that works off of the Process ID instead of the name of the process? My problem is the (my first really) script i'm trying to iron out will have multiple instances of the same executable, and also separate executables with no discernable differences (None that I could find with the AutoIt Window tool...) So I was wondering, is it possible to refer to a process by its ID? I found "_ProcessGetName" but it seems to me as if that wouldn't help after the fact.

Also, is there any way to determine when a program would be ready to accept input? As in, "WinWaitActive" almost works, yet on good occasion there is a period of "lag" that i'm unable to predict in length. The only workaround I have found is to just add an extra "Sleep" for 10 seconds or so...

So I know I might be asking alot here, but could someone help me out? Please? :lmao:

Link to comment
Share on other sites

Hiya! I just stumbled across this language and it caught my eye. I'm new to it so bear with me ;)

Is there any way to preform a function along the lines of "WinActivate", like possibly a "ProcessActivate" function that works off of the Process ID instead of the name of the process? My problem is the (my first really) script i'm trying to iron out will have multiple instances of the same executable, and also separate executables with no discernable differences (None that I could find with the AutoIt Window tool...) So I was wondering, is it possible to refer to a process by its ID? I found "_ProcessGetName" but it seems to me as if that wouldn't help after the fact.

Also, is there any way to determine when a program would be ready to accept input? As in, "WinWaitActive" almost works, yet on good occasion there is a period of "lag" that i'm unable to predict in length. The only workaround I have found is to just add an extra "Sleep" for 10 seconds or so...

So I know I might be asking alot here, but could someone help me out? Please? :evil:

In fact PID cannot select the right windows. You have to use WinGetHandle of the appropriate windows corresponding to your process and just use it in your Win... functions. :lmao:
Link to comment
Share on other sites

http://www.autoitscript.com/fileman/users/Helge/udfs/_ProcessGetHWnd.au3 is a UDF I made once for issues like this. It can return HWnds for

all of the process' windows or it can return a single one. You can also specify a title

to match.

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