← Back to team overview

sikuli-driver team mailing list archive

[Question #668708]: Saving captured image to hard drive using python

 

New question #668708 on Sikuli:
https://answers.launchpad.net/sikuli/+question/668708

This is my current working test.

    import shutil
    import os
    screenshotsDir = "C:\Users\ADDRESS_PATH\1stloop"
    wait(1)
    mySimilarity = 0.90
    Reg = Region(413,242,519,366)
    search = True
    while search:
      if Reg.exists(Pattern(Pattern("1525655012965.png").targetOffset(-1,-19)).similar(mySimilarity)):
        m = (Reg.getLastMatch())
        Xis = m.getX()
        Yis = m.getY()
        Wis = m.getW()
        His = m.getH()
        print m.getX(), m.getY(), m.getW(), m.getH()
        print(Xis)
        print(Yis)
        print(Wis)
        print(His)
        img = capture(Xis, Yis, Wis, His)
        shutil.move(img, os.path.join(screenshotsDir, "\First_image_used.png"))
        hover(Reg.getLastMatch())
        search = False
    wait(5)
    print('Finished')

The program executes without any bugs, goes right to the end, but the First_image_used.png is not being changed at all.
I noticed there was a java version that could do what I'm asking, but I'm still just learning in Python.

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