How to call same image multiple times

Asked by Test App

Hi,

How can i call and click the same image in multiple places.

#My Script

click(xyz.png)
#Code to execute 5 steps
code for step 1
code for step 2
code for step 3
code for step 4
code for step 5
####
click(xyz.png)
##Code to execute multiple steps
code for step 1
step 2
step 3
step 4
step 5
click(xyz.png)

In this code i have used click image xyz.png 3 times . Is there anyway i can assign this image to a value and keep calling that value (click.value)multiple times.I am new to Sikuli and Python as well.

Please help.

Thanks in Advance!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Roman Podolyan
Solved:
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1

what is your issues to be solved?

do you want to click 3 times?

for n in range(3):
    click("image.png")
# do something

Revision history for this message
Best Roman Podolyan (podolyan-roman) said :
#2

# according to documentation
my_match = find("xyz.png") # find returns Match object
click(my_match) # clicks what you have found earlier
# something happens
click(my_match) # clicks what you have found earlier again
#...

Revision history for this message
Roman Podolyan (podolyan-roman) said :
#3
Revision history for this message
JayG (jguajardo) said :
#4

For my simple testing i just assigned the image as a variable

i = (xyz.png)

find (i)
step 1
step 2
step 3
find (i)

Seems to work for what I need.

Revision history for this message
Test App (laxmisaketha) said :
#5

Hi ,

Thanks masuo, Roman and JayG for the reply

@Roman : Your solution solved my question . Thank you

Revision history for this message
Test App (laxmisaketha) said :
#6

Thanks Roman Podolyan, that solved my question.