sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #04155
Re: [Question #166147]: Create functions and call them whenever needed
Question #166147 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/166147
Status: Open => Answered
RaiMan proposed the following answer:
If you want to do more complex things in Sikuli script, you have to
learn some Python basics.
recommended source: http://jythonpodcast.hostjava.net/jythonbook/en/1.0/
your question:
def myFunction():
click here
click there
if any error call myError()
def myError():
popup("error occured")
exit()
/// main program
click this
myFunction()
if error: myError()
functions can have parameters (guess you know ;-)
and you can pack all your function stuff into a separate myfunctions.sikuli and import it in all your scripts
using
from myfunctions.sikuli import *
read: http://sikuli.org/docx/globals.html#importing-other-sikuli-scripts-reuse-code-and-images
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.