Jump to content
Sign in to follow this  
no925

Activating a Window from a Process ID (PID)

Recommended Posts

no925

I want to run only one instance of a program. I will know the program name but not the title.

I guess I need to use the ProcessExists statement but I don't know how to actvate the window.

So the code would be along these lines.

If ProcessExists("program.exe") Then ... Activate ... Else Run program.exe

What statements do I need to get the title via a PID so I can use WinActivate?

---

More Details

The idea is that I have GUI (written by someone else in Java)

It has user defineable link buttons that you can set for loading a URL or File

All works well except that on the 2nd click of the button a new and duplicate program/webpage gets loaded.

If it exists then I only want to activate the program/browser.

My idea is to run it through an AutoIt called Load.exe

Then instead of the link pointing directly to the program/url I would get it to link to Load.exe with a parameter.

i.e. "load program.exe" or "load http://ww....."

I intend to give this to the other programmer for distribution and therefore have no way of telling what the program will be and hence the window title.

The browser bit I think I can manage but I need help finding the window title of the process.

Any Ideas would be greatfully received!

Regards Richard

Share this post


Link to post
Share on other sites
no925

Thank you Valuater.

A small modification and that will do nicely! :whistle:

(Thanks also to SmOke_N for the code)

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  

×