Sendkeys to another window [solved]

Posts 1–6 of 6 · Page 1 of 1
Sendkeys to another window [solved]
Basically,
If aIW Console window is running activate it and send keys if not open aiw

im new at visual basic coding, searched for it on google and did look at the API's but i keep getting bunch of errors
You can test to see if the process is running like this, it's a start. If you want to add to it, you can open it if it's not already open with an ELSE statement.

Code:
Dim TargetProcess As Process() = Process.GetProcessesByName("PROCESS-HERE")
If TargetProcess.Length > 0 Then
          'The process is running
          SendKeys.Send("STUFF")
     Else
          Process.Start("PATH TO CONSOLE.exe")
End if
The problem here is that you have to be focused on the console for it to send keys.
Quote Originally Posted by Codemunkie View Post
You can test to see if the process is running like this, it's a start. If you want to add to it, you can open it if it's not already open with an ELSE statement.

Code:
Dim TargetProcess As Process() = Process.GetProcessesByName("PROCESS-HERE")
If TargetProcess.Length > 0 Then
          'The process is running
          SendKeys.Send("STUFF")
     Else
          Process.Start("PATH TO CONSOLE.exe")
End if
The problem here is that you have to be focused on the console for it to send keys.
Wow thanks, works perfectly as it should
and about the little problem, fixed it by activating the window then sending the keystrokes.

Code:
AppActivate("aIW Console")
            SendKeys.Send("blalbalblalbalb")
Once again thank youuuuu soo much
Good stuff Is AppActivate a default Visual Basic command? Or did you download it as an addon.
Quote Originally Posted by Codemunkie View Post
Good stuff Is AppActivate a default Visual Basic command? Or did you download it as an addon.
Default
/2shortttt
Marked solved. You *can* try using the SendMessage API to send it when it's not focused.
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us