cdr Posted January 14, 2006 Share Posted January 14, 2006 I'm trying to work with ClearQuest fields.ControlIDs don't work with the functions I need (ControlCommand, etc) but ClassnameNNs do. If I call the exact same function, one using the ControlID for the control and one using the ClassnameNN, only the ClassnameNN will work.So ClassnameNNs work. The problem is that they change every time the window is created - a control that's ComboBox5 this time might be ComboBox36 next time.The ControlIDs stay the same thankfully, but they don't work.All I can think of to do is somehow figure out what ClassnameNNs are mapped to the ControlIDs I need.Thanks to this thread, I can see how to get a ControlID from a ClassnameNN, which could let me at least go about it backwards.Does anyone know a way to determine the ClassnameNN from a ControlID? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 14, 2006 Developers Share Posted January 14, 2006 I'm trying to work with ClearQuest fields.ControlIDs don't work with the functions I need (ControlCommand, etc) but ClassnameNNs do. If I call the exact same function, one using the ControlID for the control and one using the ClassnameNN, only the ClassnameNN will work.So ClassnameNNs work. The problem is that they change every time the window is created - a control that's ComboBox5 this time might be ComboBox36 next time.The ControlIDs stay the same thankfully, but they don't work.All I can think of to do is somehow figure out what ClassnameNNs are mapped to the ControlIDs I need.Thanks to this thread, I can see how to get a ControlID from a ClassnameNN, which could let me at least go about it backwards.Does anyone know a way to determine the ClassnameNN from a ControlID?ControlId should work fine. Are you putting the ControlId number in quotes ? (Can you show the portion of t he code that doesn't work?) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
LxP Posted January 15, 2006 Share Posted January 15, 2006 Welcome to the forums!The _ControlGetHandleByPos() UDF might be what you need. Link to comment Share on other sites More sharing options...
cdr Posted January 15, 2006 Author Share Posted January 15, 2006 (edited) ControlId should work fine. Are you putting the ControlId number in quotes ? (Can you show the portion of t he code that doesn't work?)Should. Doesn't seem to, at least in the case of ClearQuest. I tested ControlID in Notepad and it seemed to work just fine.Some functions, like ControlGetFocus and ControlSend work correctly with ControlIDs, others like ControlCommand do not seem to work. An identical statement run once with a ControlID and once with a ClassNameNN will produce different results - ie, the ClassNameNN will work.Also, if I recall correctly, using a handle derived from the ControlID did not work.The code's at work, but here's an example:WinWaitActive( "Submit Event" ); this returns 1 or something like that$ctrlidReturn = ControlCommand ( "last", "", 32, "GetCurrentSelection", "" ); this returns the correct value$clsnamennReturn = ControlCommand ( "last", "", "ComboBox5", "GetCurrentSelection", "" ); yes, they both refer to the same controlOr if I use say SetCurrentSelection, the ClassnameNN will set it and the ControlID will do nothing.Welcome to the forums!The _ControlGetHandleByPos() UDF might be what you need.Thanks for the link. Not sure how well it'd work, since the window uses tabs and the majority of the controls are hidden at any given time. Edited January 15, 2006 by cdr Link to comment Share on other sites More sharing options...
LxP Posted January 15, 2006 Share Posted January 15, 2006 (edited) Thanks for the link. Not sure how well it'd work, since the window uses tabs and the majority of the controls are hidden at any given time.If the program in question simply hides controls when the current tab is changed (which is what most programs do), then it shouldn't be a problem. In such a case the hardest part will be determining the exact coordinates via AutoIt Window Info since there will potentially be many controls overlapping at that point (although you were able to get the ClassNameNN initially, which suggests that this isn't a problem either).Edit: Typo. Edited January 15, 2006 by LxP Link to comment Share on other sites More sharing options...
cdr Posted January 16, 2006 Author Share Posted January 16, 2006 After some more playing around, I figured out some of what was going on. Only the current tab and the last tab accessed have controls available. No controls seem to exist for the other tabs until they're accessed, which may explain why it's so damned slow when switching tabs. Two controls share one controlId - one control from the current tab, and one control from the last tab accessed. This would explain why trying to use controlIds didn't work - the command only gets sent to the leftmost control with that ID. Unfortunately, not even the GetHandleByPos() is likely to work, since the controls don't seem to exist until the tab is accessed. All in all, ClearQuest is a very annoying program and I'm left slowly switching tabs. 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