Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Screen scraping an application window and interacting with the mouse and keyboard

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.

Diverse answers are appreciated as I’m really looking at surveying what’s out there.

UPDATE

I'm looking for a way to interface with another application rather than script/macro another application.

UPDATE

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

like image 326
ccook Avatar asked May 30 '10 07:05

ccook


People also ask

What is screen scraping?

Screen scraping is the act of copying information that shows on a digital display so it can be used for another purpose. Visual data can be collected as raw text from on-screen elements such as a text or images that appear on the desktop, in an application or on a website.

Is RPA screen scraping?

One useful feature of RPA tools is screen scraping. Screen scraping involves capturing bitmap data from the screen and cross-checking it against stored information to decipher it.

What is web scraping?

Web scraping is the process of using bots to extract content and data from a website. Unlike screen scraping, which only copies pixels displayed onscreen, web scraping extracts underlying HTML code and, with it, data stored in a database. The scraper can then replicate entire website content elsewhere.


2 Answers

Check out Sikuli, it is basically what you are looking for. It is written in Java however.

http://groups.csail.mit.edu/uid/sikuli/

like image 78
Krumelur Avatar answered Oct 02 '22 00:10

Krumelur


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

like image 27
ccook Avatar answered Oct 01 '22 23:10

ccook