From: Dave Burt Date: 2005-07-15T16:45:52+09:00 Subject: Re: Capturing window display of another program? "David Brady" asked: > Is it possible to take a screenshot of another window in Ruby? (On Win32) > > I'd like to write a script to scrape the output of a graphics test program > (which I do not have source for) at regular intervals, and run tests > against them. E.g., grab the display area & check to see if it's > generating a gradient fill (good), or a black display (bad) by testing > some of the pixels inside the display area. > > What about sending clicks, drags and keypresses to that window? At that > point, it would be a poor man's WinRunner, hrm.... > You can use Ruby to interface AutoIt's COM component to make this a lot easier than using straight Windows API calls: http://www.autoitscript.com/autoit3/ http://www.autoitscript.com/autoit3/docs/functions.htm AutoIt is freeware and can do all these things pretty easily, including sending clicks and keys to a window, except for taking a screenshot AFAIK, but PixelGetColor() and PixelSearch() can be used to search for a color in a rectangle or get the color of a pixel, so maybe that's even better for your purposes. Cheers, Dave