Robot / robot.github.io

Robot documentation and information site
http://getrobot.net
zlib License
8 stars 13 forks source link

Input interception? #7

Open rogueyoshi opened 6 years ago

rogueyoshi commented 6 years ago

Is it currently possible to intercept keyboard/mouse events? What I want to do is intercept inputs from a particular program or the OS, do some processing, and optionally send those (or different) inputs back. I looked through the API and I can't seem to find anything that would help me achieve this.

dkrutsko commented 6 years ago

Unfortunately, this is not something that can be handled by robot alone. While you may get the current input state, there's no way to intercept it. If you're using Windows, it should be possible to intercept input with SetWindowsHookEx and WH_KEYBOARD_LL. But I'm not sure it's possible to send different inputs back. I'm thinking you can intercept it, and synthesize a new input. Or better yet, detect if a key is pressed and synthesize a new input in return. That, robot will be able to do.