octalmage / robotjs

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

Incredibly slow on Windows #652

Open EnderArchery opened 3 years ago

EnderArchery commented 3 years ago

When using keyTap or typeString on windows, the actions are performed very, very slowly.

Expected Behavior

When setting the keyboard delay to 1 typeString("Hello World") takes a time of about 11ms.

Current Behavior

When setting the keyboard delay to 1 typeString("Hello World") takes a time of about 2530ms.

Possible Solution

Include ansynchronous versions of keyTap and typeString that execute asynchronous key presses.

Steps to Reproduce (for bugs)

  1. Use Windows
  2. Create a js-file containing
    const robot = require("robotjs")
    robot.setKeyboardDelay(1)
    let now = Date.now()
    robot.typeString("Hello World")
    console.log(Date.now() - now)
  3. Run the file using node

Your Environment

harryjubb commented 3 years ago

Looks like this might be a duplicate of https://github.com/octalmage/robotjs/issues/530?

EnderArchery commented 3 years ago

Looks like this might be a duplicate of #530?

It seems lik it is, yes.
I haven't looked at closed issues when searching for a duplicate of a very much not fixed issue...

harryjubb commented 3 years ago

Looks like this might be a duplicate of #530?

It seems lik it is, yes.

I haven't looked at closed issues when searching for a duplicate of a very much not fixed issue...

That's definitely fair!

It looks like the issue is that it's fixed on master but hasn't been pushed to NPM.

In the meantime there's a workaround https://github.com/octalmage/robotjs/issues/628#issuecomment-742923057 I'll be trying it out, will let you know if it works for me.

harryjubb commented 3 years ago

Installing from GitHub is working for me and fixes this issue.

Hopefully the maintainers will push a new release to NPM at some point.

EnderArchery commented 3 years ago

Installing from GitHub is working for me and fixes this issue.

Hopefully the maintainers will push a new release to NPM at some point.

I don't think so, as they're searching for a new maintainer/new maintainers