← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #663164]: Help

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
import random
def randomClick(region):
    clickX = random.randint(region.x, region.x + region.w)
    clickY = random.randint(region.y, region.y + region.h)
    click(Location(clickX, clickY))

image = <capture image> # use capture button
imageMap = Region(.....) # one might use selectRegion()

while true:
    if exists(image, 0):
        click()
        wait(...) # might be needed
    else:
        randomClick(imageMap)
        wait(...) # might be needed

--- wait(...) # might be needed
depends on the reaction time of the GUI: example wait(0.3)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.