sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #00553
Re: [Question #141373]: How to loop in Sikuli so that it keeps on typing for n number of times.
Question #141373 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/141373
Status: Open => Answered
RaiMan proposed the following answer:
Python loop constructs:
--1. while <some condition>:
--2. for entry in entries:
the statements inside the loop have to be indented properly.
examples:
# loops forever
while True:
you have to use a break somewhere inside the loop to end it
if not exists(img, 0): break
would end the loop, if img is not longer visible
# loops as long as condition is true (image is found)
while exists(img, 0):
click getLastMatch()
type("some text"+Key.ENTER)
wait(3
# loops n times
for n in range(10) # 10 times, n will be 0 to 9
# loop through a list
myListFixed = (item1, item2, item3, item4)
for entry in myListFixed:
print entry
while not exists(img, 0): wait(1)
click getLastMatch()
type(e+Key.ENTER)
wait(3)
more info: Python docs
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.