Jump to content
Sign in to follow this  
MartyCologne

How to get the control coordinates stated in AutoIt v3 Window Info?

Recommended Posts

Hi,

basically, what I would like to do, is to search a listview for a specific text entry and click the item, as if one would have selected an entry in a menu. I was already able to create the code that does most of it: open the related app, work on the splash screen, open the desired window and also find the entry I am looking for. But I keep getting lost at the last step, which is to click the entry and make the overlying program do something with that.

I have been able to SELECT the text entry in the list, but that is not same as CLICK the entry.

ControlTreeView( "MyWindowname", "", $myID, "Select", $location )

will work with the control (SELECT it), but the $location is not an x/y pos. but an index, and I have not found a way to convert the index to an x/y pos accordingly that could be applied on a mouseclick action.

The index of the text line was found in a loop that browses through all text lines of the control by node and subnodes. There is no direct selectentry(mytext) that does this for me.

AutoIt v3 Window Info tool reveals the ControlClick Coords of a control in tab "Control", so it actually shows me the correct x/y-position of the SELECTED line, but:

Which function do I need to use on a control to get these values? All I could find was ControlGetPos ( "title", "text", controlID ). This does not work in my case because apparently $myID does not identify the text string as desired as in this case the controlID was found by using command $myID = _WinAPI_GetDlgCtrlID($hMenu).

ATM I cannot show a screenshot of the listview because of issues in company, I have to describe rather.

 

So, the missing steps atm are: convert index to coordinates, use mouseclick (x/y) to click on these coordinates.

 

What am I missing?

 

Thanks a lot for your comments, this has been a big issue for me for long time and nothing has really worked.

 

BTW: listview control is this type of control: WindowsForms10.SysTreeView32.app.0.141b42a_r18_ad1.

 

MartyCologne.

There used to be a question here https://www.autoitscript.com/forum/topic/155847-get-controlclick-coords/

where a user needed to know how to get the coordinates of a control and had a similar problem, but his solution does not work for me.

Edited by MartyCologne

Share this post


Link to post
Share on other sites
23 hours ago, Nine said:

_GUICtrlTreeView_DisplayRect ?

From what I understand, _GUIx commands are only for GUIs that were created with AutoIt itself. In my case the GUI is from an external application and I was not able to get the xy-Pos. using the _GUI-command.

 

Share this post


Link to post
Share on other sites
1 hour ago, MartyCologne said:

From what I understand, _GUIx commands are only for GUIs that were created with AutoIt itself. In my case the GUI is from an external application and I was not able to get the xy-Pos. using the _GUI-command.

No, you can use _GUI* function (at least some of them) on external application as long as you can get the handle of the object. 

Here an example of another way to do it :

Local $hWnd = WinGetHandle ("AutoIt Help")
WinActivate ($hWnd)
WinWaitActive ($hWnd)
Local $hTreeView = ControlGetHandle ($hWnd, "", "[CLASSNN:SysTreeView321]")
ControlTreeView ($hWnd, "", $hTreeView, "Expand", "#1")
ControlTreeView ($hWnd, "", $hTreeView, "Expand", "#1|#1")
ControlTreeView ($hWnd, "", $hTreeView, "Select", "#1|#1|#3")
ControlSend ($hWnd, "", $hTreeView,"{ENTER}")

You must start autoit help before running the example...

Edited by Nine

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...