← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #269311]: compare directory of pictures to screen with loop

 

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

    Status: Answered => Open

jhonvinage475 is still having a problem:
Thank RaiMan your answere are much appreciated,

I try to add the sample code finder but the class is very complex, sorry
my level programming is not very good.

how to pass the variable of image paths in a loop finder ?

print filename, display path in the log once but when i launch CTRL+R EXECUTE a second time i don't see anythink in the log,
when i restart the sotware sikuli same state :
i have windows 7 x64 bit, sikuli v 1.0.1 it's a bug ?
For this script do i consider the update to SikuliX 1.1.0 final under development (nightly builds available) ?



import os
dir = "D:\\stockage\\brush\\new\\original\\images\\new\\"
for e in os.listdir(dir): # this starts the loop
    fileName = os.path.join(dir, e)
    print fileName


f = Finder()
img=  # the image you are searching

f.findAll(img) # find all matches

while f.hasNext(): # loop as long there is a first and more matches
        print "found: ", f.next() # access the next match in the row

print f.hasNext() # is False, because f is empty now
f.destroy() # release the memory used by finder


    

img="1437079537448.png"

img1="photoshop.png"

wait(0.5)
type(Key.HOME)
wait(0.5)

while True: # loop forever
#while exists(Pattern(img).similar(0.99)):
    
    if exists(Pattern(img).similar(0.99)):
        rightClick(Pattern(img).similar(0.99))
            # wait(0.5)
        click(Pattern(img1).similar(0.99))
        break
    else:
        wait(0.5)
        type(Key.PAGE_DOWN)

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