屏幕抓取应用程序窗口并与鼠标和键盘交互
有一天,我发现自己沉迷于 Flash 游戏,同时也对这件事感到沮丧。在对游戏感到沮丧的时刻,我想我应该制作一个“机器人”来帮我打败它。好吧,我真的不会,但它让我意识到:我不知道如何与另一个应用程序交互来做到这一点。这让我想到了一个问题:如何截取另一个正在运行的应用程序的屏幕截图并通过键盘和鼠标与其进行交互。理想情况下,解决方案采用托管语言(例如 C#)。
当进行后台阅读时,网络上充斥着关于抓取 HTML 的文章。关于实际屏幕抓取应用程序的文章并不多。
我正在寻找一种与另一个应用程序交互的方法,而不是脚本/宏另一个应用程序。
可以用Xming之类的东西来重定向界面吗? http://www.straightrunning.com/XmingNotes/
也许是终端服务客户端? http://www.codeproject.com/KB/cs/RemoteDesktop_CSharpNET.aspx
The other day I found myself addicted to a Flash game and frustrated by the thing at the same time. In a moment of frustration with the game I thought I would make a 'bot' to beat it for me. Well, I really wouldn't, but it made me realize: I don't know how to interact with another application in a way to do this. Which brings me to the question, how would one take screenshots of another running application and interact with it with the keyboard and mouse. Ideally the solution would be in a managed language like c#.
When doing the background reading the net was drowning with articles on scraping HTML. There were not many articles on actually screen scraping an application.
I'm looking for a way to interface with another application rather than script/macro another application.
Could something like Xming be used to redirect the interface? http://www.straightrunning.com/XmingNotes/
Perhaps a Terminal Services client?
http://www.codeproject.com/KB/cs/RemoteDesktop_CSharpNET.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看看 Sikuli,它基本上就是您要找的。然而它是用 Java 编写的。
http://groups.csail.mit.edu/uid/sikuli/
Check out Sikuli, it is basically what you are looking for. It is written in Java however.
http://groups.csail.mit.edu/uid/sikuli/
我最终制作了完成所有这些工作的机器人,并将其记录在帖子
http://www.charlesrcook.com/archive/2010/09/05/creating-a-bejeweled-blitz-bot-in-c.aspx
I ended up making the bot which did all this and documented it in a post
http://www.charlesrcook.com/archive/2010/09/05/creating-a-bejeweled-blitz-bot-in-c.aspx
我使用 AutoHotKey 进行应用程序自动化。
I have used AutoHotKey for application automation.