sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #01423
Re: [Question #146227]: How to make script with sikuli that waits 1 button
Question #146227 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/146227
Status: Open => Answered
RaiMan proposed the following answer:
To understand some of my comments you might have to look in the docs
(http://sikuli.org/docx/)
--- Have a look at "How to Loop": FAQ 1437
to start something all over again in the same script
--- your if construct "converted" to Python
if find(Ex button):
ebApp.focus()
click(Rt button); click(Ec button); click(Ty button)
or even better (Python Programming Guideline)
if find(Ex button):
ebApp.focus()
click(Rt button)
click(Ec button)
click(Ty button)
--- using if find():
no good idea, since find will always end the script if not found
(if this is intended, then there is no need for an if ;-)
find(Ex button) # script stops if FindFailed
ebApp.focus() # only executed if find is successful
click(Rt button)
click(Ec button)
click(Ty button)
better use exists() in your case
if exists(Ex button):
ebApp.focus()
click(Rt button)
click(Ec button)
click(Ty button)
--- FindFailed
it is vital to understand http://sikuli.org/docx/region.html#exception-findfailed to write robust Sikuli scripts
e.g. if after click(Rt) it might be more than 3 seconds for Ec to get visible:
click(wait(Ec, 10)) # waits max 10 seconds for Ec to get visible
--- stop a script
use exit(x)
where x is returned to the environment (exit() eqivalent to exit(0))
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.