sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #09488
Re: [Question #191485]: Repeat my code
Question #191485 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/191485
Status: Open => Answered
RaiMan proposed the following answer:
--- Without understanding, what you really want to achieve with this
loop:
while exists("l.png", 0):
click( getLastMatch() )
if exists("l.png", 0):
continue
wait(1)
click("l.png")
type(Key.TAB,KeyModifier.CTRL)
wait(2)
you missed the brackets with the click. You should have been told about a "Syntax error".
If you get an error, it is always helpful, to paste the error text.
--- I have a code that I want to be repeated with the latest version
x1.0-rc3:
this how your code would loop forever:
while True:
click("l.png")
type(Key.TAB,KeyModifier.CTRL)
wait(2)
But looking at your loop construct, that does not seem to be what you
want.
--- analyzing your loop
while exists("l.png", 0): # loop will end, if l.png has vanished
click( getLastMatch() )
if exists("l.png"): continue
# if l.png still exists after the click, go to loop start and check again (???)
wait(1) # otherwise wait 1 second and check again (but it is not there anymore ???)
# loop ends, if l.png has vanished, but now you try to click it again ?????
click("l.png")
type(Key.TAB,KeyModifier.CTRL)
wait(2)
logically this all does not make much sense.
This might eventually do what you want:
click on l.png until it has vanished and the type something:
while exists("l.png", 0):
click( getLastMatch() )
wait(1)
type(Key.TAB,KeyModifier.CTRL)
wait(2)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.