Samples/UsingAddInput.ps1
## Yeah, we can simulate all sorts of mouse and keyboard input ... ## Even drag windows around by the title Select-UIElement -ProcessName Trillian -Name "#PowerShell*" | ForEach { # To drag it with the mouse, we need to offset onto the draggable part of the title Add-Input -MouseMoveX ($_.BoundingRectangle.X+50) -MouseMoveY ($_.BoundingRectangle.Y+15) | Add-Input -MouseDown LeftButton | # When we move, keep that offset Add-Input -MouseMoveX 50 -MouseMoveY 15 | Add-Input -MouseUp LeftButton | Add-Input -Input "Hello From WASP2" | Add-Input -KeyPress "RETURN" | Send-Input -WindowHandle $_.NativeWindowHandle } ## Or we can use Transform.Move Select-UIElement -ProcessName Trillian -Name "#PowerShell*" | Invoke-Transform.Move -x 0 -y 0 -Passthru | Send-Input -Input "Hello From WASP2`r" # SIG # Begin signature block # MIIarwYJKoZIhvcNAQcCoIIaoDCCGpwCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUZR+rOCaHFa0hWy2lmQUivenN # vaSgghXlMIID7jCCA1egAwIBAgIQfpPr+3zGTlnqS5p31Ab8OzANBgkqhkiG9w0B # AQUFADCBizELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTEUMBIG # A1UEBxMLRHVyYmFudmlsbGUxDzANBgNVBAoTBlRoYXd0ZTEdMBsGA1UECxMUVGhh # d3RlIENlcnRpZmljYXRpb24xHzAdBgNVBAMTFlRoYXd0ZSBUaW1lc3RhbXBpbmcg # Q0EwHhcNMTIxMjIxMDAwMDAwWhcNMjAxMjMwMjM1OTU5WjBeMQswCQYDVQQGEwJV # UzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xMDAuBgNVBAMTJ1N5bWFu # dGVjIFRpbWUgU3RhbXBpbmcgU2VydmljZXMgQ0EgLSBHMjCCASIwD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