UIA can't identify the control under mouse correctly.

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
valuex
Posts: 86
Joined: 01 Nov 2014, 08:17

UIA can't identify the control under mouse correctly.

13 Jan 2024, 22:50

I am using UIA to get the under-mouse control information in Chrome's download page.
It is expected to get the file name under mouse.
But the output is not always right, as you can see below.
Thanks for any help on fixing this problem.

Code: Select all

#Include .\Lib\UIA.ahk
F1::
{
    CoordMode "Mouse", "Screen"
    MouseGetPos(&mx,&my,&mwId)
    try
        CapElement:=UIA.SmallestElementFromPoint(mx,my)
    if !IsSet(CapElement)
        return
    ItemName:=CapElement.GetCurrentPropertyValue(30005)
    MsgBox ItemName 
}
Eorror output
1.png
1.png (27.15 KiB) Viewed 212 times
Correct output
2.png
2.png (18.21 KiB) Viewed 211 times

[Mod edit: Corrected attachments so each appears only once.]
Last edited by valuex on 14 Jan 2024, 01:12, edited 2 times in total.
User avatar
boiler
Posts: 17242
Joined: 21 Dec 2014, 02:44

Re: UIA can't identify the control under mouse correctly.

13 Jan 2024, 23:01

@valuex — I imagine that it’s the same for everyone (but you) as it is for me: The images appear as broken image links, probably because they are “private user images” as the start each of the URLs implies.
valuex
Posts: 86
Joined: 01 Nov 2014, 08:17

Re: UIA can't identify the control under mouse correctly.

14 Jan 2024, 01:15

I revised the previous post. Thanks for your reply.
Descolada
Posts: 1183
Joined: 23 Dec 2021, 02:30

Re: UIA can't identify the control under mouse correctly.

14 Jan 2024, 02:06

I tried it in latest Chrome and latest UIA.ahk, in Windows 10 with a slightly modified code:

Code: Select all

#Requires AutoHotkey v2
#include UIA.ahk

Loop {
    CoordMode "Mouse", "Screen"
    MouseGetPos(&mx,&my,&mwId)
    try
        CapElement:=UIA.SmallestElementFromPoint(mx,my)
    if !IsSet(CapElement)
        continue
    ItemName:=CapElement.GetCurrentPropertyValue(30005)
    ToolTip ItemName 
}
ChromeInspect.gif
ChromeInspect.gif (424.72 KiB) Viewed 198 times

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Google [Bot] and 26 guests