← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #175411]: How to click any images among the list?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
not a feature. You have to build your own solution.

e.g.

def clickany(images, reg = None, first = False):
    if not reg: reg = SCREEN
    for img in images:
         if reg.exists(img, 0) and first: break
    if reg.getLastMatch(): click(reg.getLastMatch())

parameter images needs to be a tuple (x, y, z, ...) (immutable array) or
list [x, y, z, ...] (mutable array)

clickany(("image1","image2","image3")) # clicks the last one found on
screen

clickany(("image1","image2","image3"), first = True) # clicks the first
one found on screen

clickany(("image1","image2","image3"), some_region) # clicks the last
one found in some_region

clickany(("image1","image2","image3"), some_region, True) # clicks the
first one found in some_region

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