How do I use FlaUI to set the value in a specific field after clicking the "Save As" button in Paint?
I'm trying to use FlaUI to automate filling a field in Paint after clicking "Save As". The field in question is named "Name:". Here is the code I have so far:
Add-Type -Path C:\Users\sergi\assemblies\bin\Release\net48\publish\FlaUI.UIA3.dll
$windowTitle = 'Untitled - Paint'
$control = 'Name:'
$automation = [FlaUI.UIA3.UIA3Automation]::new()
$process = get-process | Where-Object {$_.MainWindowTitle -match $windowTitle}
$app = [FlaUI.Core.Application]::Attach( $process )
foreach( $wnd in $app.GetAllTopLevelWindows( $automation ) ) {
$myinput = $wnd.FindAllDescendants() | Where-Object { $_.Name -eq $control }
$myinput[0].SetValue('Value Test')
}
After running the code it gives this error:
Method invocation failed because [FlaUI.Core.AutomationElements.AutomationElement] does not contain a method named 'SetValue'.
On line: 11 character: 5
+ $saveButton[0].SetValue('Value Test')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
However, I'm having a hard time finding a way to access this particular field and set its value using FlaUI. Any suggestions on how I can do this?