← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #213034]: Repeat this simple script

 

Question #213034 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/213034

    Status: Open => Answered

Brian Redmond proposed the following answer:
The indenting is important in python, so each line you want included in the loop must be indented:
while True:
    doubleClick("1351808176532.png") //open notepadd on desktop
    wait(2)
    click("Q.png") // close notepadd

and yes, this will continue to loop until one of two things happens:
1)  You manual cancel the script using the hotkey (Shift-Alt-c in Windows)
2)  The click or doubleClick throw a FindFailed Exception

If you only wanted it to loop a certain number of times, you can use for
with range.  This would loop ten times:

for x in range(10):
    doubleClick("1351808176532.png") //open notepadd on desktop
    wait(2)
    click("Q.png") // close notepadd

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