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

Roman Podolyan posted a new comment:
> The image what i'm trying to search is mutually exclusive, only one can occur 
> at time.
>  If-else-if condition helps in breaking mostly in first event.

Aha. Well, that changes things to some extent.

Ordered list of tuples to the rescue:

_______
Settings.MinSimilarity = 0.95

image_tuples_list = [("sumatra","sumatra_icon.png"), ("firefox",
"firefox_icon.png" ), ("chrome", "chrome_icon.png" )]

for key in range(0, len(image_tuples_list) - 1):
    print "Looking for " + image_tuples_list[key][0]
    if exists(image_tuples_list[key][1]):
        hover(getLastMatch())
        print image_tuples_list[key][0] + " found"
        break
______

This code goes by list of tuples one by one, it looks for images and
still has the ability to get a string ID of what was found.

When the first image has been found, loop breaks and does not search for
the next images.


Test output (Sumatra closed, firefox is open)
____
Looking for sumatra

Looking for firefox

firefox found, end of seaches
____

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to