0
$Window.Add_KeyDown({ 
 
    if ($args[1].key -eq 'Enter'){
    
    $syncHash.GEL.Value.PerformClick() #button
    
 }
})

#error
Method invocation failed because [System.Windows.Controls.Button] does not contain a method named 'PerformClick'.
:171 char:5
+     $syncHash.GEL.Value.PerformClick()
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
Keith Stein
  • 6,235
  • 4
  • 17
  • 36
Evilshig
  • 5
  • 2
  • `Button` has no such method. Try clicking programmatically instead. – Tanveer Badar Feb 03 '21 at 19:03
  • 1
    it took me a minute to convert the c# code to work with powershell but this is what i got: $syncHash.GEL.Value.RaiseEvent((New-Object -TypeName System.Windows.RoutedEventArgs -ArgumentList $([System.Windows.Controls.Button]::ClickEvent))) – Evilshig Feb 03 '21 at 19:23

0 Answers0