It's possible to simulate a keyboard stroke in node.js? Of course I would like to simulate the keyboard event on the machine where the node application is running, not in a html/js client application.
Asked
Active
Viewed 2,757 times
4
-
Node.js is a server-side technology. Do you want to simulate keyboard input on the server, or on the client? If the latter, this is rather a HTML / JavaScript specific question. – Waldheinz Sep 05 '11 at 08:26
-
I want to simulate keyboard input on the "server" (alias "where I run the node app"), because sometimes I use node.js not only for server-side application. – vannyn Sep 05 '11 at 08:29
-
Outside `fs` and `system`, node doesn't have a lot in the way of OS-specific code (though it's improving). You might have more luck making system calls to a solution specific to your OS, e.g. http://en.wikipedia.org/wiki/Expect – Alex Churchill Sep 05 '11 at 08:42
-
Thank you alex, I was searching the docs about TTY and stdin but I found nothing. This project is on Windows, so probably (if there aren't better solution) I'll use c# SendKeys method to write a simple program and then calling it from my node.js app ( something like "sendkey.exe arg1KeyToSend" ). – vannyn Sep 05 '11 at 09:18
-
Simulating keystrokes on the web server sounds really dodgy. What keys do you need to send? – Bevan Collins Sep 06 '11 at 23:50
-
I was trying to do a specific client-side application with node.js, and I would like to send inputs coming from serial port to keyboard (an arduino with RFID reader). Eventually I created another software to do this specific work. – vannyn Nov 09 '11 at 08:14
-
Keystrokes to the terminal in node.js? http://stackoverflow.com/questions/16751461/is-there-anyway-to-send-keystrokes-to-the-terminal-in-node – Arbaoui Mehdi Dec 06 '13 at 21:49