Detecting Windows with same title Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ryder
Posts: 61
Joined: 28 Apr 2022, 18:49

Detecting Windows with same title

Post by Ryder » 03 Oct 2022, 16:26

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

User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: Detecting Windows with same title  Topic is solved

Post by mikeyww » 03 Oct 2022, 16:46

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
}

Ryder
Posts: 61
Joined: 28 Apr 2022, 18:49

Re: Detecting Windows with same title

Post by Ryder » 03 Oct 2022, 17:51

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

Post Reply

Return to “Ask for Help (v1)”