Jump to content
Sign in to follow this  
Dexyna

WinActivate question

Recommended Posts

Dexyna

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
Dexyna

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.

Share this post


Link to post
Share on other sites
LarryDalooza

A simple dirty way has been to change the window title WinSetTitle()...

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
Dexyna

Doh! sorry - i see the light now :)

Problem solved. Thanks alot for the input.

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.