sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #29465
Re: [Question #258340]: How to use sikuli operations on ScreenShot Image File (UNLIKE Screen Region)
Question #258340 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/258340
Status: Needs information => Open
deva gave more information on the question:
I tried the below code in sikuli IDE 1.1.0
f = Finder("C:\Users\Admin\Desktop\FullScreenWebpage.png")
img = "iconToFind.png"
mm = list(f.findAll(img))
mmSorted = sorted(mm, key=lambda m:m.y)
baseImg = Image.create("C:\Users\Admin\Desktop\FullScreenWebpage.png")
for m in mm:
print m
s = baseImg.getSub(m.x, m.y, 50, 50).asFile()
shutil.move(s,r"<TargetPath>")
ERROR:
[error] AttributeError ( 'unicode' object has no attribute 'x' )
=========================================
I got the expected results with below code
import shutil
f = Finder("C:\Users\Admin\Desktop\FullScreenWebpage.png")
img = "iconToFind.png"
f.findAll(img) # find all matches
mm = [] # an empty list
while f.hasNext(): # loop as long there is a first and more matches
print f.hasNext()
mm.append(f.next()) # access next match and add to mm
print f.hasNext() # is False, because f is empty now
f.destroy() # release the memory used by finder
print len(mm) # the number of matches
# we want to use our matches
baseImg = Image.create("C:\Users\Admin\Desktop\FullScreenWebpage.png")
for m in mm:
print m
s = baseImg.getSub(m.x, m.y, 50, 50).asFile()
shutil.move(s,r"<TargetPath>")
Thanks!
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.