#include <WinAPI.au3>
#include "UIAutomate.au3"
$UIA_ConsoleWriteError = 0
While Sleep(100)
ToolTip(GetPath())
WEnd
Func GetPath()
Local $sPrefix = "Адрес: ", $oParent, $tPoint = _WinAPI_GetMousePos()
Local $hCtrl = _WinAPI_WindowFromPoint($tPoint)
If _WinAPI_GetClassName($hCtrl) <> "DirectUIHWND" Then Return ""
Local $oElement = _UIA_GetElementFromPoint($tPoint.X, $tPoint.Y)
If _UIA_ElementGetPropertyValue($oElement, "ControlType") = $UIA_ListItemControlTypeId Then
$sName = _UIA_ElementGetPropertyValue($oElement, "Name")
Else
$oParent = _UIA_ElementGetParent($oElement)
If _UIA_ElementGetPropertyValue($oParent, "ControlType") = $UIA_ListItemControlTypeId Then
$sName = _UIA_ElementGetPropertyValue($oParent, "Name")
Else
Return ""
EndIf
EndIf
$sPath = ControlGetText(_WinAPI_GetAncestor($hCtrl, 2), "", "ToolbarWindow322") ; Win7
;~ $sPath = ControlGetText(_WinAPI_GetAncestor($hCtrl, 2), "", "ToolbarWindow323") ; Win81, Win10
If StringRight($sPath, 1) <> "\" Then $sPath &= "\"
Return StringReplace($sPath & $sName, $sPrefix, "")
EndFunc