View Single Post
Old 7th June 2014, 21:01   #3
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 342
Question

Quote:
Originally Posted by Anders View Post
You cannot send keyboard events to a process, you can send them to the top level window by calling SendInput or keybd_event with the system plugin.

You can try to fake the messages if you need to send to a specific window by sending WM_KEYDOWN/UP messages.

I hope you are not trying to click Yes in some security dialog because that is evil. And what if the language is not English?

If you are doing a lot of automation you can try AutoIt or something like that.

What is the actual goal? Which application are you controlling and can it be done in a different way that does not involve sending fake input?
thanks
The real target is this question This is:
i after close a process need to (send y key) OR (send left arrow and after that send enter key) for confirmation stages exit.

i use this code with cmd:

HTML Code:
@if (@CodeSection == @Batch) @then

@echo off &setlocal

set "process=Project1.exe"

for /f "tokens=2" %%i in ('tasklist /nh /fi "imagename eq %process%" 2^>nul') do set PID1=%%i
taskkill /pid %PID1% /t
timeout /T 2
cscript //nologo //E:JScript "%~F0"
goto :EOF
@end

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.AppActivate("Student Register");
WshShell.SendKeys("Y");

but i need now write this code and use in nsis
There was no way for a send key to process or active a windows and send key to that?
r2du-soft is offline   Reply With Quote