Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selecting text with mouse commands #127

Closed
max-mapper opened this issue Nov 4, 2015 · 7 comments
Closed

selecting text with mouse commands #127

max-mapper opened this issue Nov 4, 2015 · 7 comments
Assignees

Comments

@max-mapper
Copy link

I have some code like this:

    robot.mouseToggle("down")
    robot.moveMouse(data.x, data.y)
    robot.mouseToggle("up")

I was hoping this would have the effect of selecting text, but I can't get the text to get highlighted Any ideas?

@octalmage
Copy link
Owner

Mouse events are really weird on Mac. I bet we'll have to specify that the mouse is down for the mouse move or something weird like that. I'll look into it this week!

@octalmage octalmage self-assigned this Nov 10, 2015
@noonat
Copy link
Contributor

noonat commented Nov 15, 2015

Looked into this a little bit, and it seems like you need to pass one of the drag event types (kCGEventLeftMouseDragged, kCGEventRightMouseDragged, kCGEventOtherMouseDragged) to get this to do a selection. It seems like the mouse button also needs to be marked as down, neither is sufficient on its own.

@max-mapper
Copy link
Author

@noonat nice work.

So it sounds like maybe we'll need a drag: true option to mouseToogle?

@octalmage
Copy link
Owner

For sure! Either that or a separate mouse drag function.

noonat added a commit to noonat/robotjs that referenced this issue Nov 16, 2015
@noonat
Copy link
Contributor

noonat commented Nov 16, 2015

I have a branch with a separate dragMouse(x, y, button) function, where button is optional and defaults to left. It seems to be working as expected.

@octalmage How would you like to handle testing for something like that?

@octalmage
Copy link
Owner

@noonat I currently don't have a way to test events like that, so don't worry about it for now. Create a pull request and I'll test it on all OSes manually.

I created something that works locally, but it doesn't work on TravisCI:

https://github.com/octalmage/robotjs/tree/keyboard-tests

See #98.

@noonat
Copy link
Contributor

noonat commented Nov 17, 2015

Opened #133 for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants