Sign in to follow this  
Followers 0
formlesstree4

What can I do with an array of handles?

3 posts in this topic

I found a function on this forum that returns a list of handles based on the parent control or window, which is exactly what I need. However, having the handles is half the battle. I also need to know what type of control it is. One thing AutoIt's Window Info does is show the ClasnameNN, the Class, and Advanced mode. Is there any way, using just the Handle, I can get that? I've used _WinAPI_GetWindowText(), but that returns a blank string for some things, and doesn't seem to be what I'm looking for. Generally speaking, these are not Microsoft controls, but, I have automated button clicking before in this software, and Window Info seems to be able to get it. I guess I'm just not searching hard enough.

Could anyone point me in the right direction please? Thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The above link will return an array of all the controls, and their control types...you can easily add a third sub element to include ControlGetText

Edit: It seems the real question you have, is how to identify controls you need to make actions on, yes? You should search the help file for Controls, and ControlGetHandle. If your GUI is static (controls aren't conditionally present), then it will be real easy to automated...just do ControlGetHandle based on ClassNN, which you will get from the autoitinfo tool...so something like

controlgethandle ("your window", "", "[CLASSNN:yourclassnn]")

If the controls are dynamic, based on conditions, you must account for the Instance shifts (instance is the number tacked on to the end of the classnn)

Edited by jdelaney

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.

Share this post


Link to post
Share on other sites

The above link will return an array of all the controls, and their control types...you can easily add a third sub element to include ControlGetText

Edit: It seems the real question you have, is how to identify controls you need to make actions on, yes? You should search the help file for Controls, and ControlGetHandle. If your GUI is static (controls aren't conditionally present), then it will be real easy to automated...just do ControlGetHandle based on ClassNN, which you will get from the autoitinfo tool...so something like

controlgethandle ("your window", "", "[CLASSNN:yourclassnn]")

If the controls are dynamic, based on conditions, you must account for the Instance shifts (instance is the number tacked on to the end of the classnn)

Well see, the program I'm working with likes to mimic what an MDI container would do...without doing it properly, and does some wonky stuff with the newly created window (no name, and AutoIt Window Information can't focus on it) which forces me to make some fun API call (_WinAPI_GetForegroundWindow()) because the regular call (WinList()) doesn't get it (despite being passed the handle of the main window). However, I was informed today that the interface is changing (joy...) which makes my entire script potentially useless.

So, to make things easier, I was going to look for ways to enumerate through the controls, and look for specific control names (for example, "[NAME:txtExportPath]" is in one of the fields). That way it would be (hopefully) easier to upgrade in the long run, so I don't need to throw away a big chunk of script (because, for all I know, the entire process could have changed; they borked the upgrade process, and I can't access the program yet). But I am using ControlGetHandle() numerous times (quite useful). Thank you very much for your help. I shall have to wait and experiment with what I'm given by them.

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