#RequireAdmin
#include <UIAutomate.au3>
; запуск
Run("adguardInstaller.exe")
$hWnd = WinWait("[TITLE:Установщик Adguard;REGEXPCLASS:HwndWrapper]")
$oWnd = _UIA_GetElementFromHandle($hWnd)
; страница 1
_UIA_WaitControlTypeElement($oWnd, "UIA_TextControlTypeId", "ЛИЦЕНЗИОННОЕ СОГЛАШЕНИЕ")
$oBtn = _UIA_GetControlTypeElement($oWnd, "UIA_ButtonControlTypeId", "Я принимаю условия")
_UIA_ElementDoDefaulAction($oBtn)
; страница 2
_UIA_WaitControlTypeElement($oWnd, "UIA_TextControlTypeId", "ВЫБОР ПАПКИ УСТАНОВКИ")
#cs отключение создания ярлыка
$oCheck = _UIA_GetControlTypeElement($oWnd, "UIA_CheckBoxControlTypeId", "Создать ярлык на рабочем столе")
_UIA_ElementDoDefaulAction($oCheck)
#ce
; далее
$oBtn = _UIA_GetControlTypeElement($oWnd, "UIA_ButtonControlTypeId", "Далее")
_UIA_ElementDoDefaulAction($oBtn)
; страница 3
_UIA_WaitControlTypeElement($oWnd, "UIA_TextControlTypeId", "РЕГИСТРАЦИЯ")
; далее
$oBtn = _UIA_GetControlTypeElement($oWnd, "UIA_ButtonControlTypeId", "Далее")
_UIA_ElementDoDefaulAction($oBtn)
; страница 4
_UIA_WaitControlTypeElement($oWnd, "UIA_TextControlTypeId", "Adguard рекомендует продукты")
; отключение продуктов Яндекса
$oChecks = _UIA_FindAllElements($oWnd, "ControlType", $UIA_CheckBoxControlTypeId)
For $i = 1 To $oChecks[0]
_UIA_ElementDoDefaulAction($oChecks[$i])
Next
; далее
$oBtn = _UIA_GetControlTypeElement($oWnd, "UIA_ButtonControlTypeId", "Далее")
_UIA_ElementDoDefaulAction($oBtn)
; закрытие окна настроек
$hWnd = WinWait("[TITLE:Adguard;REGEXPCLASS:HwndWrapper]", "", 30)
If Not $hWnd Then Exit
$oWnd = _UIA_GetElementFromHandle($hWnd)
$UIA_DefaultWaitTime = 30
_UIA_WaitControlTypeElement($oWnd, "UIA_TextControlTypeId", "Select your language")
WinClose($hWnd)