← Back to team overview

sikuli-driver team mailing list archive

[Question #190829]: Looping through findAll occurences

 

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

I am some what experimenting with the findAll function and run up a problem looping all the occurrences. 

The first one is that the looping is not top bottom or visa versa, but to me it seems ad random. What is the reason for this?
The second one is more disturbing. Below the code I used in different variants. What the script should do is switch to Finder and open and close the 'Get info' window of the files with a certain icon. This goes alright until all occurrences are done. Then it goes crazy and is click (to me) ad random things, which should not match according to the matching preview window.

Anyone know how to do this or what is going wrong in the code fragments below?

Grtz Henk

Variant 1:
FinderApp = App("Finder")
FinderApp.focus()        
wait(2)           
findAll(Pattern("LbsIcon.png").similar(0.30))
icons = SCREEN.getLastMatches()
for icon in icons:
       click(icon)
       type("i",KEY_CMD)
       wait(2)
       type("w",KEY_CMD)        

Variant 2:
FinderApp = App("Finder")
FinderApp.focus()        
wait(2)           

for icon in findAll(Pattern("LbsIcon.png").similar(0.30)):
      click(icon)
       type("i",KEY_CMD)
       wait(2)
       type("w",KEY_CMD)        

Variant 3:
FinderApp = App("Finder")
FinderApp.focus()        
wait(2)           
icons = findAll(Pattern("LbsIcon.png").similar(0.30))
for icon in icons:
      click(icon)
       type("i",KEY_CMD)
       wait(2)
       type("w",KEY_CMD)        

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