sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #51425
[Question #680253]: Looping infinite with observer
New question #680253 on Sikuli:
https://answers.launchpad.net/sikuli/+question/680253
Breaking my head again :)
I didnt want to post and find the answer myself, but reading the docs endlessly and not getting it, here I am again.
code:
=====================
r = Region(1059,318,18,17)
tr = TextOCR.start()
tr.setPSM(6)
def eventstop(event):
event.stopObserver()
r.onChange(eventstop)
r.observeInBackground(200)
wait(4)
r.highlight(2)
print r.text() #just to check and compare the number with my own eyes
if int(r.text()) < 18:
print r.text()
print (" is > 18")
else:
print r.text()
print (" is < 18")
==================
I want to infinite loop my code. so that he checks again after he read the previous number.
1) GOTO didnt work :( (I noticed afterwords it doesnt excist in phyton *sad face*
2) wait(IMAGE, FOREVER)
didnt work, I wanted to do infinite looping while a certain images excised on the screen. (I got this from your Desktop Surveillance exercise (I would love to see more of those practical examples)
3) I tryed (FOREVER) but still closed
4) I tryed after the IF and Else statement "r.observe()"
thinking that , I can just start the observer again and he starts again from the top (which didnt work).
5) I noticed with the following code that aslong he finds it , he is infinite. But when he doesnt find it , it closes the script. (which I dont understand why) So I assume I have to do something special with the IF, else statement to get the infinite loop?
while ("1555266479704.png",FOREVER):
if find("1554910622874.png"):
popup ("YES")
else:
popup ("NO")
I cant sleep, I cant eat, getting depression and nightmares of code. So hopefully you can help me out :) Thank you!
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.