Code: Select all
#Requires Autohotkey v2.0+
#Include <UIA>
#Include <UIA_Browser>
Run "chrome.exe https://google.com"
WinWaitActive "ahk_exe chrome.exe"
cUIA := UIA_Browser()
cUIA.ElementFromHandle()
if (button := cUIA.ElementFromPathExist("VR0/")) && InStr(button.Name, "Google Account")
button.Click() ; already logged in
else if (button := cUIA.ElementFromPathExist("VR5/")) && (button.Name == "Sign in")
button.Click() ; click Sign in