sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #01096
Re: [Question #144169]: Last click refuses to work
Question #144169 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/144169
Status: Open => Answered
RaiMan proposed the following answer:
I collected the scripting statements and made some "optimizations"
--- never ending loop: while True:
--- just wait some seconds: wait() instead of observe()
--- using exists( ... , 0) (only one search, do not wait 3 seconds) in while loops with own timing using wait
while True: # Neverending loop
click( image1 )
click( image2 )
click( image3 )
click( image4 )
click( image5 )
click( image6 )
wait(4) # wait for load
while exists( image7, 0 ): # while image7 is in place,
click( image 8 )
wait(1)
click( image9 ) # <-- The problem.
wait(5)
-- your question:
It is always a problem here, to recognize indentation, but your click( image9 ) seems to be on the same indent level as the first while, and hence outside the loop. So after image7 vanishes, the loop starts all over again, but should stop with a FindFailed, if I understand the intended workflow right (image9 has to be clicked before starting all over again).
If I understand you right, this is what you want:
I put the indentation levels as comments like # +1, where the number
means the number of indent tabs in the IDE
while True: # Neverending loop
# +1
click( image1 )
click( image2 )
click( image3 )
click( image4 )
click( image5 )
click( image6 )
wait(4) # wait for load
while exists( image7, 0 ): # while image7 is in place,
# +2
click( image 8 )
wait(1)
# +1
click( image9 ) # <-- The problem.
wait(5)
# +0
print "outside loop"
the print statement will never be executed, since your while True: loop
does not contain any code to end the loop (e.g. a break to jump out of
the loop or an exit() to gracefully end the script) (see FAQ 1437)
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.