Question #252629 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/252629
Status: Open => Answered Eugene S proposed the following answer: Hi, May I propose some changes into your code first? 1. Use "try, except" structure 2. There is no need for "else" clause here because you really have just 2 options, the image was found or it wasn't. 3. Use exists with '0' parameter to make it more time efficient. This way, it will return the results immediately rather than waiting 3 default seconds. 4. Use loop for multiple button presses. Just to make it a bit more pretty and easy to change. So something like that: import org.sikuli.script.FindFailed as FindFailed #Sikuli Bug #1216338 for idx in range(5,106): try: wait("caption.png", 0) 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) for i in range(24): type(Key.DELETE) click("1406907972716.png") type(Key.PAGE_DOWN) print "idx #%d" %(idx) except FindFailed: click("1406907972716.png") type(Key.PAGE_DOWN) print "skip" + str(idx) Please try that and see if that works better for you. Cheers, Eugene -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. _______________________________________________ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp