Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AutoIt with wpf

Tags:

wpf

autoit

I have below sample code for my wpf app. I need to fill in text fields of form with strings.

    Run('AutoItWpfTesting.exe')
    WinWaitActive("Window1", "")

    $hHwnd = WinGetHandle("Window1")
    MsgBox(0, "Message", $hHwnd)

   $returnVal1=ControlGetHandle ( "$hHwnd", "", "[NAME:txtVersion]")

   $returnVal2=ControlSend($hHwnd,"","[NAME:txtVersion]","blahblah")

   MsgBox(0, "Message", $returnVal2)

it returns 0 for $returnVal2 and Empty string for $returnValue1. However this works fine for my sample winform application.

Any clues why this behaviour is..and Any tweaks available to get exact text-box to auto fill data for wpfa app.

like image 916
Anees Avatar asked Jan 18 '23 11:01

Anees


1 Answers

WPF applications do not use Windows' controls and handles for the controls. You can see that by using Spy++. WPF Alternatives for Spy++

If you want to automate WPF applications you will need another tool or use the UI Automation API to build one.

like image 163
Emond Avatar answered Jan 21 '23 12:01

Emond