#include <UIAWrappers.au3>
#include <CUIAutomation2.au3>
HotKeySet('{ESC}', 'Close') ; Set ESC as a hotkey to exit the script.
HotKeySet('{Pause}', 'GetElementInfo')
$sPattern = '1.txt|Новая папка' ; файлы
_UIA_Init()
While 1
Sleep(100)
WEnd
Func GetElementInfo()
Local $t = TimerInit()
Local $hWnd, $sName, $sClass, $sNameElement, $k, $sText = ''
Local $tStruct = DllStructCreate($tagPOINT)
Local $aP = StringSplit($sPattern, '|')
For $x = 0 To @DesktopWidth Step 25
For $y = 0 To @DesktopWidth Step 25
DllStructSetData($tStruct, 'x', $x)
DllStructSetData($tStruct, 'y', $y)
$objUIAutomation.ElementFromPoint($tStruct, $pUIElement)
$oUIElement = ObjCreateInterface($pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
$objUIAutomation.RawViewWalker($pTW)
$oTW = ObjCreateInterface($pTW, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker)
If IsObj($oTW) = 0 Then ContinueLoop
Local $parentHandle
$oTW.getparentelement($oUIElement, $parentHandle)
$objParent = ObjCreateInterface($parentHandle, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
If IsObj($objParent) = 0 Then ContinueLoop
If IsObj($oUIElement) Then
$sName = _UIA_getPropertyValue($objParent, $UIA_NamePropertyId)
$sClass = _UIA_getPropertyValue($oUIElement, $UIA_ClassNamePropertyId)
$sNameElement = _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)
If StringRegExp($sName, $sPattern, 0) And $sClass = 'UIProperty' And $sNameElement = 'Имя' And Not StringRegExp($sText, $sPattern, 0) Then
$sText &= $sName & '_'
$sPattern = StringRegExpReplace($sPattern, '(' & $sName & '\|)' & '|' & '\|(' & $sName & ')', '')
ConsoleWrite(_UIA_getPropertyValue($oUIElement, $UIA_BoundingRectanglePropertyId) & @CRLF)
$k += 1
If $k = $aP[0] Then ExitLoop 2
EndIf
EndIf
Next
Next
ConsoleWrite(TimerDiff($t) & @LF)
EndFunc ;==>GetElementInfo
Func Close()
Exit
EndFunc ;==>Close