Repeat script multiple times --- look FAQ 1437

Asked by VJ

the information in faq 1437 is more up to date.
--------------------------------------------------------------------

Hello, I'm a rookie so please excuse my limited knowledge of scripting - don't know anything. In fact sikuli is the only reason I'm even trying this.

I've managed to create a script that is essential for my needs. However, I need to keep it repeating (if it is successful the first time) How do I do this?

For e.g. script runs, tasks completed - loop to play again - if script stops in the middle for any reason - the loop stops.

Thank you for any assistance that can be provided.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

The principle:
while True:
   find() # your script statement
   click() # your script statement
   wait() # your script statement
   click() # your script statement
   sleep(10) # e.g. to give it a pause

ATTENTION: since its python-syntax, each statement inside the while-loop has to be indented by the same number of blanks (e.g. 3).

when using Sikuli version 0.9.9 (recommended!), the script will stop, if any of these find()'s (explicit or implicit (click, wait, ...)) fail.

So if you want to stay at the basics right now, to stop the loop, try the key-combi shift-alt-c (Win) shift-cmd-c (Mac). If this does not work (I found situations where it did not do), just produce a screen situation, where find() should fail.

You are welcome to come back with any questions. If you want some specific support (e.g. more sophisticated stuff ;-), pls. paste your script.

Revision history for this message
Othmar (ofluck) said :
#2

Thank you! This answer helped me! ;-)

Revision history for this message
RaiMan (raimund-hocke) said :
#3

look into faq 1437