bogQ Posted September 4, 2014 Share Posted September 4, 2014 for the first problem my assumption is that some other tab is activated, try to see if it works if you switch to that tab manualy before you try to click or send space on button that is connected to that tab, ofc still try to use ClassnameNN in controlID parametar TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 On the problem where I've got two buttons both with the same name I've collect some more info right now my simple script is running $title = "Edit" WinActivate($title) WinWaitActive($title) sleep(1000) $text = ControlGetText($title,"","[ClassnameNN:WindowsForms10.BUTTON.app.0.ea7f4a_r13_ad19]") MsgBox(1,"button text",$text) I just want to see if I'm able to read the text on the button. I'll try clicking it after. Results of running the script is the window activates, a second goes by then the messagebox opens and is blank. This is the information from the info tool for both of the buttons. They're both in the same window on the same tab. >>>> Window <<<< Title: Edit Class: WindowsForms10.Window.8.app.0.ea7f4a_r13_ad1 Position: 290, 153 Size: 1045, 666 Style: 0x16CA0000 ExStyle: 0x00050101 Handle: 0x0000000000131428 >>>> Control <<<< Class: WindowsForms10.BUTTON.app.0.ea7f4a_r13_ad1 Instance: 9 ClassnameNN: WindowsForms10.BUTTON.app.0.ea7f4a_r13_ad19 Name: button1 Advanced (Class): [NAME:button1] ID: 397882 Text: Lookup Position: 245, 399 Size: 75, 23 ControlClick Coords: 30, 11 Style: 0x5601000B ExStyle: 0x00000000 Handle: 0x000000000006123A >>>> Window <<<< Title: Edit Class: WindowsForms10.Window.8.app.0.ea7f4a_r13_ad1 Position: 290, 153 Size: 1045, 666 Style: 0x16CA0000 ExStyle: 0x00050101 Handle: 0x0000000000131428 >>>> Control <<<< Class: WindowsForms10.BUTTON.app.0.ea7f4a_r13_ad1 Instance: 18 ClassnameNN: WindowsForms10.BUTTON.app.0.ea7f4a_r13_ad118 Name: button1 Advanced (Class): [NAME:button1] ID: 332222 Text: Lookup Position: 175, 125 Size: 75, 23 ControlClick Coords: 44, 19 Style: 0x5601000B ExStyle: 0x00000000 Handle: 0x00000000000511BE Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 (edited) I got it. I had to switch to class and instance so something like ControlClick($title,"","[CLASS:WindowsForms10.BUTTON.app.0.ea7f4a_r13_ad1;Instance:9]") to specifically get that button. Now that seems to stay stable on each run of the program, but is something like the instance # going to change if the programmers move/add/remove controls on that form? Tying tests to versions is fine I just need to know that I'll need to do it. Edited September 4, 2014 by strider3700 Link to comment Share on other sites More sharing options...
jdelaney Posted September 4, 2014 Share Posted September 4, 2014 (edited) Sure will. Are the IDs constant, when you relaunch your app? If so, that's the way to go. I think all the junk after BUTTON.app.* is unique per session as well, but could be recalling incorrectly. That, or you can loop through all buttons, until you get the one that matches your name, and IsVisible (controlcommand function) last attempt: ConsoleWrite(ControlGetHandle("yourtitle","","[NAME:button1; INSTANCE:1]") & @CRLF) ConsoleWrite(ControlGetHandle("yourtitle","","[NAME:button1; INSTANCE:2]") & @CRLF) at least this way, if it works, errors from new buttons MAY only occur when a new button with the same name is added Edited September 4, 2014 by jdelaney strider3700 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 So far the id's and info in the class appears to be stable through numerous launches. I haven't tried running the tests on a different machine yet but will do so before declaring victory. I had tried the [NAME:button1; INSTANCE:2] matching previously and it never seemed to match for me Link to comment Share on other sites More sharing options...
jdelaney Posted September 4, 2014 Share Posted September 4, 2014 Yeah, the 'controls' help file doesn't specify ALL the little quirks of using multiple identifiers. Some, if they exist at all, negate all other identifiers....such as attempting to get the second instance of an ID...the ID trumps any use of instance. ID's would certainly be the best, then. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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