henryp Posted July 17, 2009 Share Posted July 17, 2009 (edited) 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 July 17, 2009 by henryp Link to comment Share on other sites More sharing options...
Drew Posted July 17, 2009 Share Posted July 17, 2009 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 More sharing options...
henryp Posted July 17, 2009 Author Share Posted July 17, 2009 (edited) 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 July 17, 2009 by henryp Link to comment Share on other sites More sharing options...
henryp Posted July 17, 2009 Author Share Posted July 17, 2009 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 More sharing options...
MDCT Posted July 18, 2009 Share Posted July 18, 2009 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now