Comment 3 for bug 1251163

Revision history for this message
obiwan-92 (obiwan-92) wrote :

I try to launch your code with some modification :

from java.awt import Color
from java.awt import Robot

def findItemsOfColor():
    area = Region(0,0,600,400)
    area.highlight(1)
    wait(1)
    x = area.x
    y = area.y
    i=0
    while i==0:
        x = x+1
        p = Location(x,y)
        aColor = Color(0x6969FF)
        if Robot().getPixelColor(p.x, p.y) == aColor:
            print "FOUND ITEM!!!"
            click(x+4,y+4)
            wait(1)
        if x > area.x + area.w:
            print "Searched row"
            x = area.x
            y = y + 1
            if y > area.y + area.h:
                i = 1
                break

findItemsOfColor()

---
It's working but it's very slow. It's probably because you ask the color of each pixel directly without using a buffered image.
Try the code I release in #1. It should be faster. The function Robot().createScreenCapture() return a BufferedImage object.

Regards.