sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #01520
Re: [Question #146706]: Call function
Question #146706 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/146706
Status: Open => Answered
RaiMan proposed the following answer:
BTW Sikuli speaks Python, which is much easier to learn and handle than
Java ;-)
This is the basic approach: (already looked at FAQ 1437 ?)
see comments below --X
while True: #--1
#Search function
while not exists(X, 0): #--2
sleep(10)
#Command function
if exists(Y): #--3
click(X)
print "Now we have left the While True: loop"
-- comments
--1 this will loop FOREVER, which is principally not good idea since you
would have to interrupt Sikuli with the abort key combination
to test it, this would go:
for i in range(10): # would loop 10 times
exists(X, 0) does not wait 3 seconds, but comes back after first try.
This easier to calculate the time.
normally you should have a conditional break somewhere in the loop, to
end it (if condition: break)
--2 this will loop until X shows up. will loop FOREVER, if X does not show up
again you could use a counting loop:
for i in range(60): # this would loop about 70 seconds
if exists(X, 0): break
wait(10)
--3 exists(x) not needed - we know already it is there from the previous
while loop
here is the question, what should happen if the click fires? It will
instantly go back to #--1 as it would in the case either X or Y are not
visible.
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.