Code: Select all
#SingleInstance Force
#NoTrayIcon
;#IfWinActive ahk_exe antimicrox.exe
#Include <UIA_Interface>
UIA := UIA_Interface()
runApp(appName) {
For app in ComObjCreate("Shell.Application").NameSpace("shell:AppsFolder").Items
Run, % app.Name = appName ? "explorer shell:appsFolder\" app.Path : ""
}
if not A_IsAdmin
Run *RunAs "%A_ScriptFullPath%"
1:: ; Mouse
WinGet, hWnd, ID, Antimicrox
winEl := UIA.ElementFromHandle("ahk_id" hWnd)
winEl.FindFirstByNameAndType("Mouse", "TabItem").Click()
return
2:: ; Advanced
WinGet, hWnd, ID, Antimicrox
winEl := UIA.ElementFromHandle("ahk_id" hWnd)
winEl.FindFirstByNameAndType("Advanced", "Button").Click()
return
3:: ; close window
WinGet, hWnd, ID, Antimicrox
winEl := UIA.ElementFromHandle("ahk_id" hWnd)
winEl.FindFirstByNameAndType("Close", "Button").Click()
return
$^w::winclose ; exit app