Robot/robot-js

keyboard hold key sticky

Disorrder opened this issue · 3 comments

Hello. If I press a key, wait some time and release, I have no "sticky" effect like aaaaaaaaaaaaaaaaaa:

var kb = new robot.Keyboard();
kb.press(robot.KEY_A);
robot.Timer.sleep(2000);
kb.release(robot.KEY_A);
kb.click(robot.KEY_BACKSPACE);

I have tried setTimeout also, but no luck

Hey there, so the way the internal API's work, at least for Windows, is one press/release is one click. You have to keep looping that code to repeat it. It was this way from my testing at least. For repeating, you may have to simulate a real keyboard. If you would like more information let me know but I was able to set up an Arduino Micro and communicate to it through serialport to simulate "real" keys. Might work better for you.

wow, not necessary :) Loop is maybe okay

The reason I bring it up is in case you have applications scanning for injected (or fake) input that just gets thrown away. You'd either have to solve it by using some sort of keyboard driver or real hardware. Anyways, hope this helps. Good luck!