Bernat
19th March 2008 11:31 UTC
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.
Takhir
19th March 2008 12:47 UTC
For pre-defined stdin string http://nsis.sourceforge.net/ExecCmd_plug-in may help
Afrow UK
19th March 2008 19:12 UTC
Simplest solution is invoke keybd_event with System plug-in.
Stu
Bernat
19th March 2008 19:39 UTC
@ 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.
Takhir
20th March 2008 08:22 UTC
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...
Xokar
10th July 2009 16:25 UTC
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.
Afrow UK
10th July 2009 17:21 UTC
Use keybd_event. Easier to implement and it should still work on Vista.
Stu
Xokar
11th July 2009 14:02 UTC
Unfortunately keybd_event doesn't work with TS RemoteApps, I desperately need SendInput.