Page 1 of 1

Insert Username with UIA (UI automation)

Posted: 01 Jul 2020, 05:52
by daywalker
I used this wrapper from jethrow
https://github.com/jethrow/UIA_Interface/blob/master/UIA_Interface.ahk
trying to insert with UIA the username to windows security question.
Unfortunalty username does not insert. Anyone who has a idea?
Thank you!

Code: Select all

#include UIA_Interface.ahk

hwnd:= WinExist("Windows-Sicherheit ahk_class Credential Dialog Xaml Host")

uia := UIA_Interface()
xd := uia.ElementFromHandle(hwnd)
condition_user := uia.CreateAndConditionFromArray([uia.CreatePropertyCondition(UIA_ControlTypePropertyId := 30003, button := 50004, VT_I4 := 3), uia.CreatePropertyCondition(UIA_NamePropertyId := 30005, "Benutzername", VT_BSTR := 8)])
element_user := xd.FindFirst(condition_user, TreeScope_Element := 0x1)
IAccessible := element_user.GetCurrentPatternAs("LegacyIAccessible")
IAccessible.SetValue(A_username)