Help with UIA login
Posted: 16 Feb 2023, 09:59
I made a YouTube app with MS Edge and a script that will open the app, but won't continue to interact with the elements. The only way to do so is to switch to make editor in order to refresh the script, then the hotkey you will make YouTube active and continue with the elements. I keep getting an error with line 11 where I had tried YouTube ahk_exe msedge.exe and msedge.exe:
Can you also tell me what's wrong with my DumpAll():
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())
}