Sign in to follow this  
Followers 0
cdr

ClassnameNN from ControlID?

6 posts in this topic

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?

Share this post


Link to post
Share on other sites



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?)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 control

Or 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 by cdr

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by LxP

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0