← 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 you for this wonderful code that helps a lot.


it's a good idea to compare the directory for duplicates but I have already done this step with the VisiPics software.

What I want is clear from the panel software directory those who are
already all duplicates.

Your help allowed me to do that but I always compare the same and it does not cycle up and down in the panel with the scrollbar to the right,
To check the three screen (3 page down) because there are in the software 2913 brushes and only 221 duplicates in the directories.

a help would be welcome :


# collect the image files (import os not needed in Sikuli IDE)
dir = "D:\\stockage\\brush\\new\\original\\images\\new\\"
images = [] # to store the filenames
for e in os.listdir(dir): # this starts the loop
    if not e.endswith(".png"): continue
    images.append(os.path.join(dir, e)) # collect

# declare variables
img1="photoshop.png"

# loop for each image in directory (one by one with path and name) and delete in the panel software and leave the loop or exit after the last picture in the directory
# need check only one time of an image because i want to delete the duplicate in the software panel but keep the other

for e in images:
    wait(0.5)
    type(Key.HOME)
    wait(0.5)
    if exists(Pattern(e).similar(0.99)):
        rightClick(Pattern(e).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.