← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #147333]: looping problem

 

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

RaiMan proposed the following answer:
it seems you have not read faq 1437 (indentation missing) - but anyway

This is valid Python code:

click (img1)
while find( "img1" ):
   click(img )
while not find ( "img1" ):
   wait (5)
click (img2)

But Sikuli script ???

find() in if/elif/while does not make sense, since if not found the script will stop anyway
(see docs http://sikuli.org/docx/region.html#exception-findfailed)

If img1 is not found, the script will stop anyway with the 1st click()

the intention of:

while not find ( "img1" ):
   wait (5)
click (img2)

is ok, but would never work (see above):

while not exists( "img1" ): # will wait until img1 comes up
   wait (5)
click (img2)

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