Jump to content
Sign in to follow this  
MrKris1224

Multiple controls with same class

Recommended Posts

Hi, i'am making automation script to another application in my job. The problem is application have many controls with same class name and instance. So i tried to get handle of controls by them position. There is problem because in application there's many controls that have same position (they ar in another tabs). So i included control's size. It works a long time, but now i need get handle of control which have position and size like another control in application window (in another tab). 

Can anyone have any solution for that? I think ControlGetFocus will be suitable but that returns ClassnameNN. IT is possible get control handle or ID which is actually focused?

Controls isn't standard windows controls.

Update

Maybe it will help. All controls are from Visual Component Library, application is written in Delphi. It is a way to use VCL lib in autoit?

Update

This control is "TPageControl". By controls loop i got that control have "TTabSheet" controls which are tabs but Autoit Window Info doesn't showing them (bug?) i got handle to "TTabSheet" control but tab doesnt changing if i use ControlClick.

Some info about control: TPageControl


Any Ideas?

Edited by MrKris1224

Share this post


Link to post
Share on other sites

Possible workaround:

ControlClick($hWnd, '', '[CLASS:TPageControl; INSTANCE:1]', 'primary', 1, $g_aGuiLoc[$LOC_TAB_2][$COORD_X], $g_aGuiLoc[$LOC_TAB_2][$COORD_Y])

Where $g_aGuiLoc contains coordinates to (somewhere inside) concerning tab header (relative to TPageControl's location).

Address controls by INSTANCE. First activation of each tab changes INSTANCE number of controls (cycle through all tabs first for INSTANCE to consistently relate to same control). Now it should be possible to address controls by for example [CLASS:TEdit; INSTANCE:25] (even if another tab than containing one is visible).

Not all GUICtrl...() functions work for Delphi controls (most cases solvable using workarounds however).

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...