Run same script to a greater extent

Asked by sami baig on 2018-01-02

I would like to run following script more than 10 times on single instruction

myScript:

click("1514867348422.png")
if exists("1514867386964.png"):

while not exists("1514871869228.png"):
wait(10)
click("1514867400749.png")
type(Key.TAB, KeyModifier.SHIFT + KeyModifier.ALT)
else:
popup("Script done.")

       Should I paste this script manually more than one or is there any coding to run this script multiple times ?

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
sami baig
Solved:
2018-01-03
Last query:
2018-01-03
Last reply:
2018-01-03
masuo (masuo-ohara) said : #1

define function and call that function in while loop.

def script1():
    click("1514867348422.png")
    if exists("1514867386964.png"):

        while not exists("1514871869228.png"):
            wait(10)
        click("1514867400749.png")
        type(Key.TAB, KeyModifier.SHIFT + KeyModifier.ALT)
    else:
        popup("Script done.")

for i in range(10):
    script1()

sami baig (gabbarmic) said : #2

Thanks, You resolved my query.