← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #176332]: Finding an image of a certain color

 

Question #176332 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/176332

    Status: Open => Answered

RaiMan proposed the following answer:
I am using the latest build from the above download and had no problems
with red, yellow, green squares.

This is my script:

import java.awt.Robot as JRobot
myRobot = JRobot()

hover("1319649806076.png")
p = getLastMatch().getCenter()
print myRobot.getPixelColor(p.x, p.y), "at", p

hover("1319649881686.png")
p = getLastMatch().getCenter()
print myRobot.getPixelColor(p.x, p.y), "at", p

hover("1319649893970.png")
p = getLastMatch().getCenter()
print myRobot.getPixelColor(p.x, p.y), "at", p

The 3 images are screenshots of some inner part of the respective
colored squares on the screen.

Additionally, you can see, how to use AWT Robot.

javadocs:
http://download.oracle.com/javase/6/docs/api/java/awt/Robot.html

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.