Closed ch3rn1k closed 2 years ago
Sample code:
const win = new Hardware();
win.keyboard.toggleKey(['ctrl', 'v'], true);
setTimeout(() => win.keyboard.toggleKey(['ctrl', 'v'], false), 2000);
Expected it should hold Ctrl+V
and it will paste data in some input for 2 second (if caret is active), but I'm only getting single paste
Toggle works as expected (you can open keyboardchecker and check it), but I found a bug with the false
toggle (does not release the last key and releases the first key 2 times) and fixed it in the last version (2.0.4). If you want to paste a copy within 2 seconds, you can simply call the sendKey method in a loop.
Can you explain how
keyboard.toggleKey
should work? I expected that after usingkeyboard.toggleKey(['ctrl', 'v'], true)
it should hold an 'Ctrl+V' key andkeyboard.toggleKey(['ctrl', 'v'], false)
should release it. But I'm getting single paste askeyboard.sendKey(['ctrl', 'v'])
Am I doing something wrong?