← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #189606]: Want to use 2 images in if exists statement

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- if you do not need to know, which one
if exists(imgA, 0) or exists(imgB, 0):
    print "either imgA or imgB is there"
else:
    print "not there"

--- if you want to know, which one:
isImgA = False
isImgB = False
if exists(imgA, 0): isImgA = True
if exists(imgB, 0): isImgB = True
if isImgA or isImgB:
    print "either imgA or imgB is there"
    if isImgA:
        print "imgA is there"
    if isImgB:
        print "imgB is there"
    if isImgA and isImgB:
        print "imgA and imgB are there"
else:
    print "not there"

--- comment on exists(img, 0)
0 as the second parameter to exists forces, that only one search is executed and the result returned immediately. It does not wait the standard 3 seconds, so it is very responsive. So this version is ideal for situations like you have, where you only want to know, wether an image is there or not, to make a decision on the further workflow.
To check 3 images "concurrently" costs about 1 - 2 seconds.

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