Jump to content

WinActivate question


Recommended Posts

Hello,

I ran into this problem ... i have multiple windows with the exact same name - for example "Notepad" and (of course) "Notepad" with different PID's of course.

My question - for the smarter-than-me ppl - is : how can i activate, and focus windows, based on PID and not on the Window Name.

I hope that someone comes up with a solution - i have not discovered it yet ...

Link to comment
Share on other sites

Hello,

I ran into this problem ... i have multiple windows with the exact same name - for example "Notepad" and (of course) "Notepad" with different PID's of course.

My question - for the smarter-than-me ppl - is : how can i activate, and focus windows, based on PID and not on the Window Name.

I hope that someone comes up with a solution - i have not discovered it yet ...

You're welcome to wait for an answer from someone smarter-than-you, but until then:

Get a 2D array list of matching windows with $avWinList = WinList("Notepad"), then use the handles in $avWinList[$n][1] to get the process IDs with WinGetProcess(). Since you are not interested in the titles, you could replace the titles in $avWinList[$n][0] with your PIDs. Now you've got handle and PID together in a single array to use as you please.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You're welcome to wait for an answer from someone smarter-than-you, but until then:

Get a 2D array list of matching windows with $avWinList = WinList("Notepad"), then use the handles in $avWinList[$n][1] to get the process IDs with WinGetProcess(). Since you are not interested in the titles, you could replace the titles in $avWinList[$n][0] with your PIDs. Now you've got handle and PID together in a single array to use as you please.

:)

Thanks for the reply - still, this does not solve my issue . How to WinActivate a window if i have 2 windows with the same name , and how to switch from one to the second (maybe third) using WinActivate - since all the windows have the same name, i cannot say for sure that the window that is active is the first, second or third. Like i said , multiple windows with the exact name.
Link to comment
Share on other sites

Like i said , multiple windows with the exact name.

And like I said, USE THE HANDLES NOT THE NAMES.

Take a closer look at what comes out of WinList(). The window handle can be used almost anywhere the title would be in AutoIt functions. Window handles are unique to the window, no matter how many have the same name.

:)

Pretty precocious penguin program posting prodigious perspicacity.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...