level20peon Posted May 16, 2009 Share Posted May 16, 2009 (edited) I have been trying to write a script which clicks on button a if it exists or button b if button a and b exist.Without success.Both buttons have the same class, so I searched for a method to determine whether or not a specific instance of a class exists in a window. Doesn't seem to be the case.WinGetClassList() didn't help since there it doesn't return instance information.How would one check for a class instance to exist ? Edited May 20, 2009 by level20peon Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 16, 2009 Moderators Share Posted May 16, 2009 Search the help file for "Window Titles and Text (Advanced)". You'll see that you can reference windows or controls by instance. Link to comment Share on other sites More sharing options...
level20peon Posted May 16, 2009 Author Share Posted May 16, 2009 (edited) I created a workaround by checking for the instance text with ControlGetText() which I use to compare the output strings.I still am interested if there is a more elegant way to check for the existence of class instances though.EDIT: you replied when I composed this post. I will see if I find additional information here.EDIT2: I didn't find a way to check for an instances existence using the "Window Titles and Text (Advanced)" information.I tried something like thisWinWaitActive("[TITLE:WindowTitle; CLASS:ClassXYZ; INSTANCE:1]", "")Subsequently an "if WinExists(...)" doesn't throw results either.Any idea what I'm doing wrong here ? Edited May 16, 2009 by level20peon Link to comment Share on other sites More sharing options...
level20peon Posted May 19, 2009 Author Share Posted May 19, 2009 Should I have replied to my own post ? Link to comment Share on other sites More sharing options...
Authenticity Posted May 19, 2009 Share Posted May 19, 2009 You're not waiting for a window, you're waiting for a specific control to appear on that window: $hwnd = WinGetHandle('Window Title') ; Case sensitive, so take it into consideration. $hButton = 0 Do $hButton = ControlGetHandle($hwnd, '', 'Button2') ; The second instance, shorthand for '[CLASS: Button; INSTANCE:2]'. Sleep(50) Until $hButton ;... Link to comment Share on other sites More sharing options...
level20peon Posted May 19, 2009 Author Share Posted May 19, 2009 I see this makes sense. Thanks for your explanation. 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