sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #07007
Re: [Question #179267]: Running Script from middle
Question #179267 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/179267
Status: Open => Answered
RaiMan proposed the following answer:
if you want to do this manually in the IDE, the put the lines not needed
for this run in a block comment (3 apostrophes before and after):
"""
# the following lines up to the
# end of block comment
# will be ignored
.... some lines follow
"""
# from here will be executed
click()
wait()
.... some lines follow
If you want to do this programmatically, you might make the first 50 statements dependent from a condition, that has to be met:
if condition:
click() # only executed if condition is met
# mind indentation
# the following statements will be executed anyway
click()
wait()
The most flexible way is to put lines of code, that for some logical
entity into def()'s and run them as needed:
def first_part():
click() # only executed if first_part is called
# more lines follow, mind indentation
def second_part():
click() # only executed if second_part is called
# more lines follow, mind indentation
# now we use the def()'s
first_part() # all statements of first_part are executed
second_part() # all statements of second_part are executed
This can be combined with the above if construct.
Python (the scripting language of Sikuli using the IDE) has many more
options ;-)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.