How do you record keystrokes when operating on another window in Java?

前端 未结 3 986
慢半拍i
慢半拍i 2021-01-21 17:44

I\'m looking to record keystrokes and mouse positions while I\'m in a browser window on various websites, but I\'m not sure how to do this outside the SWING (or some other GUI)

相关标签:
3条回答
  • 2021-01-21 18:39

    The support you need is not exposed by Java. It is a fairly simple matter to do this if you have access to the RECORD extension in X, or Win32 on Windows.

    Here is a Python project that implements support for both of these platforms: pykeylogger.

    0 讨论(0)
  • 2021-01-21 18:44

    I don't think you can do this from pure Java. If it is possible at all, it would require the assistance of a (highly) platform specific native code library.

    0 讨论(0)
  • 2021-01-21 18:47

    (Windows only) In theory you could use JNA or JNI to bind to GetAsyncKeyState and you'd be able to monitor key presses.

    0 讨论(0)
提交回复
热议问题