Linux/X Window 系统下的屏幕阅读/鼠标点击?
我正在学习人工智能(只是为了乐趣和练习,不是为了利润或任何邪恶的东西)我想编写一个小机器人来为我玩一个小小的 Flash 游戏。
作为一个微软仇恨者,我很不好意思地说,我知道并且前段时间在Windows下使用过所需的函数调用,在Delphi中编程。但这些天我尝试在Linux下做所有事情,但我似乎没有任何想法。
要求:
- 定期或根据编程请求以图像或位图形式抓取部分屏幕内容;
- 在编程控制下模拟鼠标指针移动和左键单击;
- 键盘抓取也可能派上用场。
理想情况下,我希望通过在 JVM 中运行的 Clojure 应用程序来执行此操作,因此 Java 兼容库将是猫的喵喵声。但如果做不到这一点,我可以自己编写一个 C 程序,通过本地 TCP/IP 在 X Window 和我的应用程序之间进行调解。
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 Microsoft 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您始终可以依赖旧的 java.awt .Robot 类,我认为它具有您要求的所有功能:
You can always rely upon the good old java.awt.Robot class, which, i think, has all the features you're asking :