Jump to content

Identifying a window without the "Title"


Recommended Posts

Im trying to Identify a window using the Text/Buttons on the window.

The title will change according to the languages that i am using, so it is not reliable for me to identify the window based on the title. So im trying to WinWaitActive the window according to some buttons/Text on it. How can i do this?

I have tried:

WinWaitActive(*) - WildCard for any text?

WinWaitActive([0-9])

Basically i have Any Text for title, and have a specified text for button/visible text.

Thanks!

Edited by henryp
Link to comment
Share on other sites

WinGetHandle() <-- This would give you an unchanging grasp on the window. Note: When using this function the "text" parameter is completely ignored.

ControlClick() <-- Helpful for any clicking and etc. you would like to do.

WinSetTitle() <-- This would change the title to whatever you like.

Using the AutoIt Window Tool , you can retrieve all the information required to fill out the parameters in the previously mentioned functions.

Tip:

Set a variable to WinGetHandle() so you only have to get it once.

Any other questions , or if I didn't answer your current one correctly feel free to ask.

Link to comment
Share on other sites

WinSetTitle: asks for the title to begin with. The problem is i dont know the title of the window, so how can i use it?

WinGethandle: the handle of all the windows are the same for my app. It just have a "next" button... which is the same Instance and same class.

Im still not sure how i would identify the window Which only "title" changes.

Class Position Size Style Exstyle handle and instance stays the same. I was hoping there was a way to ignore the "title" while using the "Text" in the window to WinWait.

Thx for the help!

Edited by henryp
Link to comment
Share on other sites

NM, I found my solution.

For future references:

I used Advanced WinTitleMatchMode. I just used the class(which is always the same in my case) and some unique text in each window.

WinwaitActive([CLASS:#70020 Instance:3],"Agree")

Link to comment
Share on other sites

NM, I found my solution.

For future references:

I used Advanced WinTitleMatchMode. I just used the class(which is always the same in my case) and some unique text in each window.

WinwaitActive([CLASS:#70020 Instance:3],"Agree")

henryp, in case you need to do the original plan of yours (which check window based on the text), it can be achieved by using WinGetText.

While 1
Sleep(100)
$ActiveWin=WinGetHandle("[ACTIVE]")
If @error continueloop
$text = WinGetText($ActiveWin, "")
consolewrite($text)
Wend

Basically, code above will get active window handle and use that handle to get text.

However, if the window has class, I believe using class is much more reliable than check for the text which can take time to check the string of text, and in case like notepad the text can be changed easily.

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