@SteveMylo,
Once you have created a TreeWalker with a certain condition, you can feed it any element you want and call the TreeWalker methods on that element. So you can just feed the element gotten by GetNextSiblingElement into the TreeWalker again, like this:
Code: Select all
XValue := tw.GetNextSiblingElement(XText) ; First sibling
nextFromXValue := tw.GetNextSiblingElement(XValue) ; Second sibling, and so on...
Notice that the element you got with the inspector.exe tool is of type "Window". This means that DaVinci is generating a custom window (GUI) for the Audio/Video panel, and getting the information from these proved tricky... I ended up creating a custom tool (for now named UIATreeInspector), where if you uncheck Visible and click though all the Resolve.exe files you should eventually find the correct window for the Audio and Video panels. Unfortunately it still doesn't display the buttons inside (for example Lock Track), so its of not much use. So I think interacting with those buttons is pretty much hopeless (though if you really need it, you could request the creators of DaVinci to implement UIAutomation a bit better in their programs).2. In the inspector.exe tool when you click on the Rectangle icon 'watch focus' button only and not the 'watch cursor', it gives you access to a few more spots (in Davinci for example) that the watch Cursor can't.
But I can't use the data from it, for example, the AutomationID.
If you see the pictures below. I used it to separate the Video and Audion panels, normally they are one big Panel. But any data given by the 'watch focus' method doesn't do anything even though it shows you a unique AutomationID.
Is it possible? It would be a great help for me in automating.
You can also get all the windows' info like this (paste it somewhere):
Code: Select all
#SingleInstance, force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 2
DetectHiddenWindows, On
#include <UIA_Interface>
UIA := UIA_Interface()
WinActivate, DaVinci Resolve
WinGet, wList, List, ahk_exe Resolve.exe
Clipboard := ""
Loop, %wList%
{
hwnd := wList%A_Index%
winEl := UIA.ElementFromHandle(hwnd)
Clipboard .= "Window with hwnd " hwnd "`n" winEl.DumpAll() "`n`n"
/*
automationIds := winEl.FindAll(UIA.CreateNotCondition(UIA.CreatePropertyCondition(UIA.AutomationIdPropertyId, "")))
for k, automationEl in automationIds {
if InStr(automationEl.CurrentAutomationId, "AudioTracks") {
; Do something
}
}
*/
}
MsgBox, Finished.
ExitApp