Jump to content

Controls with same ID


JJ_07
 Share

Recommended Posts

Hello,

I'm new to AutoIt and I am trying to automate an application that wasn't developed by me and after using the "AutoIt v3 Window Info" turns out that multiple controls have the same ID number and only the coordinate numbers are different, no class or instace number is available. I tried to use the Advanced controlID feature:

ControlSend('Set Measurement Channels', "", "[X:268; Y:76; W:64; H:24]", "sample_text" )

 where the position and size of the control could be added, but it did not work. Altough, it did using only the ID:

ControlSend('Set Measurement Channels', "", "[ID:1060]", "sample_text" )

This sent the text to the first control, but since the other controls also have the same ID, this approach is wouldn't work... I attached two pictures of the returned information from AutoIt V3 Window Info of two different controls. Is there any way to send text to this controls with the information that is available?  another tool that could help me find the ID of each of them? or am I sending the coordinates in the wrong way?

Thanks in advance 

 

Unbenannt.PNG

Unbenannt2.PNG

Link to comment
Share on other sites

Have you tried combining both ID and position ?

If that doesn't work you could use :

#include <WinAPISysWin.au3>  ; put those 2 lines on top of your script 
#include <Array.au3>

Local $hWnd = WinGetHandle ("Set Measurement Channels")
Local $aArr = _WinAPI_EnumChildWindows ($hWnd)
_ArrayDisplay ($aArr)

You can then use the handles retrieve in the array to access each control

Link to comment
Share on other sites

56 minutes ago, JJ_07 said:

 another tool that could help me find the ID of each of them? 

Try Yashieds "Control Viewer", same as the infotool, just better, picks up more.

 

Edited by Werty

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

17 hours ago, Werty said:

Try Yashieds "Control Viewer", same as the infotool, just better, picks up more.

 

 

18 hours ago, Nine said:

Have you tried combining both ID and position ?

If that doesn't work you could use :

#include <WinAPISysWin.au3>  ; put those 2 lines on top of your script 
#include <Array.au3>

Local $hWnd = WinGetHandle ("Set Measurement Channels")
Local $aArr = _WinAPI_EnumChildWindows ($hWnd)
_ArrayDisplay ($aArr)

You can then use the handles retrieve in the array to access each control

Thanks Nine, it worked using the Handle as the ControlID ! And I tried using both ID and position but still only the first control was being accessed.

ControlSetText('Set Measurement Channels', "", $aArr[12][0]  , "333" )

 

Link to comment
Share on other sites

1 hour ago, JJ_07 said:

Thanks Nine, it worked using the Handle as the ControlID !

Great, glad it worked.  Also you should use the handle of the window like this :

#include <WinAPISysWin.au3>  ; put those 2 lines on top of your script 
#include <Array.au3>

Local $hWnd = WinGetHandle ("Set Measurement Channels")
Local $aArr = _WinAPI_EnumChildWindows ($hWnd)
ControlSetText($hWnd, "", $aArr[12][0]  , "333" )

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...