Consider the following AHK v2 script, which utilizes the UIA-v2 library…
- User
Consider the following AHK v2 script, which utilizes the UIA-v2 library (https://github.com/Descolada/UIA-v2)
#Requires AutoHotkey v2.0
; Inlcude UIA-v2 (by descolada) #include
Run("ms-settings:colors")
WinWaitActive("Settings", , 3)
settings := UIA.ElementFromHandle("Settings ahk_exe ApplicationFrameHost.exe")
mode_comboBox := settings.WaitElement({ Name: "Choose your mode", cs: 0, mm: 2, Type: "ComboBox" })
list_items := mode_comboBox.FindAll({ Type: "ListItem" })
MsgBox("Found " list_items.Length " items:") For item in list_items { MsgBox(item.Name) }
Does my settings variable contain a live (or potentially stale) reference of the UIA Tree for UIA.ElementFromHandle("Settings ahk_exe ApplicationFrameHost.exe")?
Also, when I run the script, in the resulting MsgBox popup's, the script finds 1 item (not 3) and the found item was "Custom", which is the current and visible selection. I think this is the expected behavior, but I'm not sure.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.