Page 1 of 1

Detecting Windows with same title

Posted: 03 Oct 2022, 16:26
by Ryder
Hi all,

Have an issue with detecting windows that have the same title. In one case it is the main window of an application.

In some cases, the application opens up a requester window with the exact same title...

This causes confusion in my code.

The only difference between the two (apart from the size) is the ahk_class:

ahk_class ElFRAME (This is the main application)

ahk_class Elbl17BXM (This is the requester)

I check for windows every 250 milliseconds.

How can I perform a check that catches the requester opening... but ignores the fact that the application (with the same title) is already open?


Thank you!!!

R

Re: Detecting Windows with same title  Topic is solved

Posted: 03 Oct 2022, 16:46
by mikeyww
Use the :arrow: WinTitle that specifies the window class.

Code: Select all

winTitle = ahk_class Elbl17BXM
If WinExist(winTitle)
     MsgBox, 64, Success, Yep!
Else MsgBox, 48, Failure, Nope!
Or:

Code: Select all

#SingleInstance Force
winTitle = ahk_class Elbl17BXM
Loop {
 WinWait, %winTitle%
 MsgBox, 64, Success, Found it!
 WinWaitClose
}

Re: Detecting Windows with same title

Posted: 03 Oct 2022, 17:51
by Ryder
Deceptively simple :)

This worked well. Thank you, sir!

My only concern is that another window using the same class might pop up, but so far, that has not been the case. It seems to be truly unique.
Fortunate.

R