octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.26k stars 937 forks source link

need help:why the keyToggle() can't press and hold for few secends? #687

Closed Cloudkkk closed 2 years ago

Cloudkkk commented 2 years ago

why the keyToggle() can't press and hold for few secends?

Expected Behavior

for example,I wanna hold the “w” for 2s, it should print wwwwwwwwwwww in the box;

Current Behavior

I can only find a “w” in the print box,although I set a 2s 。

Context

my code

const robot = require('robotjs');   
robot.keyToggle("5","down");
setTimeout(function(){
robot.keyToggle("5","up");
}, 2000);

Your Environment