Archive: How to Send Keys with NSIS?


How to Send Keys with NSIS?
Hello,

I use NSIS to compile launchers for portable applications and I want to simulate key strokes as done by:
AutoIt

Send("{TAB}")

or VBScript
WshShell.SendKeys ("{TAB}")

Is there some plugins or code to do this with NSIS?
Thanks in advance for answer.

For pre-defined stdin string http://nsis.sourceforge.net/ExecCmd_plug-in may help


Simplest solution is invoke keybd_event with System plug-in.

Stu


@ Afrow UK
Thanks for your quick reply. I think that keybd_event is my solution and I will study your link.

@ Takhir
Thanks also for your quick reply. Your plugin is interesting for me because I want also send a string to an input field.

If I succeed in a script I will post in this topic.


Please note that for keybd_event() or SendInput() your application should 1) be detached from installer (use Exec, not ExecWait or nsExec); 2) be visible; 3) have keyboard focus (to be restored before every char). For last point you need window handle. May be I forgot something else...


Did anyone manage to get SendInput working?

I've attempted to write the code but it's coming back with error 87:

System::Call '*(i1,i9,i0,i1) i.R0'
System::Call "User32::SendInput(i1,iR0,i1)?e"
Pop $R1
Detailprint $R1
System::Free $R0

I'm trying to send a Tab.


Use keybd_event. Easier to implement and it should still work on Vista.

Stu


Unfortunately keybd_event doesn't work with TS RemoteApps, I desperately need SendInput.