Jump to content
Sign in to follow this  
GordonFreeman

Executables with the same name - WinSetTitle

Recommended Posts

GordonFreeman

Hi. I am a layman in autoit. My problem is this, I created a script to change the name of the window with thePID of the respective process. In the first run work fine, but then he always uses the same PID as the process name is the same. I know the error but not the solution. Can anyonehelp me?

ShellExecute("BLA.exe")

Sleep(3000)

$PID = ProcessExists("BLA.exe")

WinSetTitle("Blaaa Bla Bla","",$PID)

Exit

I want to make each window with its PID real and not only the first

Note: I can not change the name of the executable

happens the following problem:

BLA.EXE - REAL PID: 1234 - WINDOW NAME: 1234

the second time I open my program have:

BLA.EXE - REAL PID: 1234 - WINDOW NAME: 1234

BLA.EXE - REAL PID: 3131 - WINDOW NAME: 1234

i need so:

BLA.EXE - REAL PID: 1234 - WINDOW NAME: 1234

BLA.EXE - REAL PID: 3131 - WINDOW NAME: 3131

Share this post


Link to post
Share on other sites
Beege

If your lanching an exe i would use Run() instead of shellexecute. Shellexecute is more for opening a file with its default application. Using Run() will return the pid without the need for ProcessExists(). Is that the whole script your running? If so, are you just running it twice to get the second bla.exe to launch?

Share this post


Link to post
Share on other sites
GordonFreeman

If your lanching an exe i would use Run() instead of shellexecute. Shellexecute is more for opening a file with its default application. Using Run() will return the pid without the need for ProcessExists(). Is that the whole script your running? If so, are you just running it twice to get the second bla.exe to launch?

Thank you for your help. I reached my goal. perfect

ProcessExists and depedence of sleep removed, now is perfect, big ty man. See:

$PID = Run("BLA.exe")

WinWaitActive("Blaaa Bla Bla")

WinSetTitle("Blaaa Bla Bla","",$PID)

Exit

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.