How to click objects in sequence?

Asked by ircfas133

Hi, everyone:

Could I ask how to let the Sikuli to click a list of file icon (e.g., text file icon in Win7) from top to down? Right now if I use the following, Sikuli click on file in random order.

for x in finaAll("text icon"):
    click(x)

Thank you!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
j
Solved:
Last query:
Last reply:
Revision history for this message
Best j (j-the-k) said :
#1

You can order your found matches:

icons = findAll( "text icon" )
sorted(icons, key=lambda m:m.y) # sorts the found icons by y value

for icon in icons:
    click(icon)

Revision history for this message
ircfas133 (ircfas133) said :
#2

Great! I tried it out. It works great!

Revision history for this message
ircfas133 (ircfas133) said :
#3

Thanks j, that solved my question.

Revision history for this message
ircfas133 (ircfas133) said :
#4

Thank you so much!