Code: Select all
#SingleInstance Force
#Requires AutoHotkey v2.0.2
#NoTrayIcon
#Include <UIA-v2>
#Include <UIA_Browser-v2>
#HotIf
q::
{
If WinExist("YouTube ahk_exe msedge.exe")
WinActivate()
Else runApp("YouTube")
runApp(appName) {
For app in ComObject("Shell.Application").NameSpace("shell:AppsFolder").Items
Run(app.Name = appName ? "explorer shell:appsFolder\" app.Path : "")
}
; Get the element for the YouTube window
ytEl := UIA.ElementFromHandle("ahk_exe msedge.exe")
; Wait for the button by name and type, then click it
ytEl.WaitElement({Name:"Sign in", Type:"Link"}).Click()
; Enter email and password
ytEl.WaitElement({Name:"Email or phone", Type:"Edit"}).Value := "EMAIL ADDRESS"
ytEl.FindElement({Name:"Next", Type:"Button"}).Click()
}
Can you also tell me what's wrong with my DumpAll():
Code: Select all
q::
{
El := UIA.ElementFromHandle("scite.exe")
El.FindElement("Type=Toolbar")
MsgBox(A_Clipboard := El.DumpAll())
}