newbiescripter Posted March 30, 2008 Share Posted March 30, 2008 (edited) Hello My problem is that. when I try to controlclick on a specific button in the program then it works fine if I take the controlID and run the script, but when I then close the program, open it up again and then try running the script again it will not click on the button. I have found out that it is because the ControlID and the ClassnameNN is changing every time the program is restarting. So I need to find a way to get the controlID in the beginning of my script. Just like PixelGetColor - this will return the specific color in that pixel. like this I need the ControlID on the button in that pixel. Hope you understand what I mean and that it is possible Regards Edited March 30, 2008 by newbiescripter Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 30, 2008 Share Posted March 30, 2008 Hello My problem is that. when I try to controlclick on a specific button in the program then it works fine if I take the controlID and run the script, but when I then close the program, open it up again and then try running the script again it will not click on the button. I have found out that it is because the ControlID and the ClassnameNN is changing every time the program is restarting. So I need to find a way to get the controlID in the beginning of my script. Just like PixelGetColor - this will return the specific color in that pixel. like this I need the ControlID on the button in that pixel. Hope you understand what I mean and that it is possible Regards What remains constant in the control: Text, Location, Class, ...? You can use the advanced match modes to find it. For example, if the the Class was always NewFunkyButton, but the instance kept changing, and the text was always "Click Here":ControlClick("Window Title", "Optional Text", "[CLASS:NewFunkyButton; TEXT:Click Here]") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
newbiescripter Posted March 31, 2008 Author Share Posted March 31, 2008 There is unfortunaly no text in the control and the class is also changing and so are the ID. The location is always the same. on mousecoord (120,50) in the window, so I could use mouseclick, but i just doesn't find this as the right solution. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 31, 2008 Share Posted March 31, 2008 There is unfortunaly no text in the control and the class is also changing and so are the ID.The location is always the same. on mousecoord (120,50) in the window, so I could use mouseclick, but i just doesn't find this as the right solution.Then you are down to enumerating the control classes with WinGetClassList() and then walking the array, testing for multiple instances of each class, and testing the position of each control for a match. It will help if there are any common elements or patterns in the class name, as this would allow a better RegExp type test of the class name, but it could be done purely on position. I believe SmOke_N posted a UDF for this, something like ControlGetHandleByPos() (not the exact name). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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