I sent the definition of the built-in member function Acc.__FromPointDPI from QM to Grok3 for it to learn, and then asked it to generate the equivalent QM code for the C# function.
The generated code should be logically correct, but there are two errors(Todo1,Todo2). This might be due to the unique aspects of QM. I searched for relevant information but couldn't find an answer.
PS: If the UIA components used by QM are too outdated and no longer valuable, please ignore this post. I was just curious and wanted to test Grok3's coding capabilities.
Also, I would like to know, does QM use UIA2 or UIA3?
Macro UIA2
Member function Acc.__FromPointDPI
The generated code should be logically correct, but there are two errors(Todo1,Todo2). This might be due to the unique aspects of QM. I searched for relevant information but couldn't find an answer.
PS: If the UIA components used by QM are too outdated and no longer valuable, please ignore this post. I was just curious and wanted to test Grok3's coding capabilities.

Macro UIA2
UIA.CUIAutomation-- u._create
UIA.IUIAutomationElement e = u.GetFocusedElement
UIA.IUIAutomationElementArray children = e.FindAll(UIA.TreeScope_Children, u.CreateTrueCondition)
str draftName = "HomePageDraftTitle:3月8日"
int found = 0
UIA.IUIAutomationElement c
for _i 0 children.Length
,;Get the Name property of the control
,c=children[_i] ;;Todo
,str name = c.GetCurrentPropertyValue(UIA.UIA_NamePropertyId)
,if(name == draftName)
,,out name
,,found = 1
,,; Get the parent control
,,UIA.IUIAutomationElement parent = c.GetCurrentPattern(UIA.UIA_LegacyIAccessiblePatternId).GetIAccessible.Parent ;;Todo
,,if (parent)
,,,out parent.CurrentName
,,,; Simulate click
,,,parent.DoDefaultAction
,,break
if (!found)
,out "No draft named %s found" draftName
Member function Acc.__FromPointDPI
function x y
;Same as FromXY, but with many objects works correctly on Win8.1+ in DPI-scaled windows.
;Still does not work correctly with many objects, eg almost all Windows controls and window parts, but works with IE, FF, Chrome, many other non-Windows objects.
#opt nowarnings 1
#if _winver>=0x603 ;;note: no UIA typelib on XP/Vista
if DpiIsWindowScaled(win(x y))
,;get IUIAutomationElement from point and convert to Acc. It fails with many objects, but works in web browsers.
,UIA.CUIAutomation-- u._create
,UIA.tagPOINT p.x=x; p.y=y
,UIA.IUIAutomationElement e=u.ElementFromPoint(p)
,UIA.IUIAutomationLegacyIAccessiblePattern k=e.GetCurrentPattern(UIA.UIA_LegacyIAccessiblePatternId)
,a=k.GetIAccessible; elem=0
,if(a) ret
,err+
#endif
this=acc(x y 0)
err end ERR_OBJECTGET