Screen reading / mouse clicking under Linux / X Window System?
I'm learning about AI and (just for fun and practice, not profit or anything evil) I'd like to write a little bot to play a rinky-dink Flash game for me.
As a Micr开发者_运维知识库osoft hater, I'm embarrassed to say that I know and have used the required function calls some time ago under Windows, programming in Delphi. But these days I try to do everything under Linux and I don't seem to have any idea.
Requirements:
- to grab part of the screen's contents in image or bitmap form, periodically or on programmatic request;
- to simulate mouse pointer moves and left clicks under programmatic control;
- keyboard grabbing might come in handy too.
Ideally, I'd like to do this from a Clojure application running in the JVM, so a Java compatible library would be the cat's meow. But failing that, I could write myself a C program to mediate between X Window and my app via local TCP/IP.
You can always rely upon the good old java.awt.Robot class, which, i think, has all the features you're asking :
- moving mouse
- capturing a Rectangle on screen
- clicking mouse
精彩评论