mousegetpos alternative

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
JustinNL
Posts: 28
Joined: 01 Sep 2020, 13:22

mousegetpos alternative

Post by JustinNL » 25 Apr 2021, 14:41

Hi all,

I have a question.

Say that I get the X and Y coordinates of a control using imagesearch. I can then move the mouse using

Send {click, x, y, 0}

And get the text or other info of this control using MouseGetPos.

However, is there an alternative to MouseGetPos where you don’t have to move the mouse to that position? So just provide the X and Y coordinates and get the same info you would get from MouseGetPos? (Or at least the text and name of the control on that coordinate?)

Best,
Justin
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: mousegetpos alternative

Post by boiler » 25 Apr 2021, 14:50

You could get the list of controls for a given window using the ControlList sub-command of WinGet, then for each of those, use ControlGetPos to get the bounding area of each control, then you could determine which control is under any specific location and get whatever info you want for that control using ControlGet and related commands.
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: mousegetpos alternative

Post by boiler » 25 Apr 2021, 14:56

JustinNL wrote: I can then move the mouse using

Send {click, x, y, 0}
It's a bit more straightforward to do this:

Code: Select all

MouseMove, x, y, 0 ; 0 is for fastest speed
Post Reply

Return to “Ask for Help (v1)”