← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #254592]: Using a list of stored captures

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
if time does not matter, then the easiest approach is to loop through
your lCaptures and try to find each one successively in the other drop-
down

dd = <the region of the other drop down>
ddSuccess = []

for image in lCaptures:
    if dd.exists(image):
        ddSuccess.append(dd.getLastMatch())
    else:
        ddSuccess.append(None)

after this run, ddSuccess contains the corresponding matches and None
for the images not yet found.

now you have to scroll down the list and run this as often as needed, so
we pack it in a def

def repeatSearch():
    n = 0
    for success in ddSuccess:
        if not success:
            if dd.exists(dd[n]):
                ddSuccess[n](dd.getLastMatch())
        n += 1

and make a loop

shouldRepeat = True
while shouldRepeat:
    scrollDownList() # a def that does it
    repeatSearch()
    shouldRepeat = decideAboutRepeat() # evaluate if we should stop and return false otherwise true

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