GithubHelp home page GithubHelp logo

Support for double click about robotjs HOT 9 CLOSED

octalmage avatar octalmage commented on September 26, 2024
Support for double click

from robotjs.

Comments (9)

octalmage avatar octalmage commented on September 26, 2024

Hello,

I believe every OS has a limit to how fast it can receive events, and this is probably what you're running into.

Have you tried putting a delay between the two clicks?

I will probably add some support for a built in configurable delay at some point to help with this.

from robotjs.

octalmage avatar octalmage commented on September 26, 2024

#14 is related, I'll try to do some testing today.

from robotjs.

navFooh avatar navFooh commented on September 26, 2024

I haven't had any luck putting a delay between the clicks unfortunately.
I'm triggering the events over a websocket server but I doubt that has anything to do with it
Hope you have more luck!

Cheers, Thijs

from robotjs.

octalmage avatar octalmage commented on September 26, 2024

I've done some testing and you're right, setting a delay doesn't work! It looks like some additional code is needed to double click on Mac, I'll work on getting this implemented now!

from robotjs.

navFooh avatar navFooh commented on September 26, 2024

Thanks man, I'll be happy to help testing after!

from robotjs.

octalmage avatar octalmage commented on September 26, 2024

Using the code from here:

http://stackoverflow.com/questions/1483657/performing-a-double-click-using-cgeventcreatemouseevent/1483666#1483666

Specifically CGEventSetIntegerValueField I was able to get double click working in at least one app, but it doesn't work in Finder or Google Chrome. It's very strange. If you'd like to test, check out the doubleclick branch.

I've added a second parameter to mouseClick, so robot.mouseClick("left", true); does a double click. I'll keep working on it.

from robotjs.

navFooh avatar navFooh commented on September 26, 2024

Sorry I've moved on to another project now and don't have much time at the moment.

Just thinking that with this implementation you'd have to set some kind timer after a click to wait for a possible double-click before triggering the mouse click event. This would make a normal click less responsive (in my case where I'm controlling the mouse from another machine).

If there's no other way to go about this, so be it. just a same that to sequential clicks don't register as a double click like normally in the OS.

from robotjs.

octalmage avatar octalmage commented on September 26, 2024

No worries.

Good point! I don't understand why there's a separate event for double clicks on Mac, that makes this difficult. I'm sure I'll find a better solution though.

from robotjs.

octalmage avatar octalmage commented on September 26, 2024

I got double click working in all apps on Mac, but unfortunately it will require a separate function, at least for now.

On Windows the double click delay is customizable, which would be an issue, but using GetDoubleClickTime we can accurately send a double click.

I'll submit a PR for this soon.

from robotjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.