sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #27463
Re: [Question #252629]: for loop/if elif statement not working correctly
Question #252629 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/252629
Description changed to:
I have the following code in Sikuli that does copy and paste tasks. I
want it to execute the actions inside "if not exists" when caption.png
does not exist, but sometimes even if it doesn't, it is still trying to
find it and returns an error that says "can't find caption.png".And
sometimes it randomly jumps one idx. Can't figure out why:
for idx in range(5,106):
if not exists("caption.png"):
click("1406907972716.png")
type(Key.PAGE_DOWN)
print "skip" + str(idx)
elif exists("caption.png"):
click("caption.png")
type(Key.F2)
type("a", KeyModifier.CTRL)
type("c", KeyModifier.CTRL)
click("CLICKBOX-4.PNG")
click("BOX2-4.PNG")
type("a", KeyModifier.CTRL)
type(Key.DELETE)
type("v", KeyModifier.CTRL)
type(str(idx))
type(Key.HOME)
type(Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE + Key.DELETE)
click("1406907972716.png")
type(Key.PAGE_DOWN)
print idx
else:
print "nonsense" + str(idx)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.