Send-Keys to an non active Window

Oct 22, 2014 at 1:03 PM

i am using WASP since today, and ill try this:

Using WASP which is sending Send-Keys commands to notepad++; but if click on another application the Send-Keys commands will be send to application which i have opened.

Is there a function in WASP where i can send the Send-Keys commands to notepad++ when its not active?

My Script:
ipmo .\WASP.dll
$bla = $false
try {            
$ActiveHandle = [UserWindows]::GetForegroundWindow()            
$FindProg = Get-Process | Where-Object {$_.Name -eq 'notepad++'}
$FindProg | Select ProcessName, @{Name="AppTitle";Expression= {($_.MainWindowTitle)}}            
} catch {            
 Write-Error "Failed to get active Window details. More Info: $_"            
while($bla -eq $false){
Select-Window $FindProg | Send-Keys ('Hello')
Sleep -Seconds 2
Select-Window $FindProg | Send-Keys ('Hello')
Sleep -Seconds 2
Select-Window $FindProg | Send-Keys ('Hello')
Sleep -Seconds 2
Oct 22, 2014 at 4:13 PM
No. It's not possible, in windows (for your protection).

You can't simulate input to an app that doesn't have focus -- because that would allow malicious apps to do anything they wanted.

Even when apps fully support UI Automation, and implement the "Value" field, invoking the SetValue member will require focus. See this example, for instance: