sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #17393
Re: [Question #225999]: Precision issues with observe()
Question #225999 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/225999
Status: Answered => Open
diveratis is still having a problem:
Mmmm I appreciate the advice you've provided, but unfortunately the script doesn't work as planned when the timeout argument in exists() is set to values smaller than 1.
----
def logTime(refCapture, locRegion):
refImg = capture(locRegion)
click(refCapture)
startTime = time.time()
while True:
lapTime = time.time()
if not locRegion.exists(Pattern(refImg).similar(0.99), 0):
print "Test"
stopTime = time.time()
break
print "Total Time: ", stopTime-startTime
print "Last Search: ", stopTime-lapTime, "\n"
For some reason if the 2nd argument is <1, regardless of whether
.similar() is 0.99 or even 0.01, the locRegion.exists will always return
a 0 [thereby making the if-not statement true] and exit the while loop;
It will output the Total Time and Last Search lines, even as the screen
has visually not even updated yet. However, if I change the argument
value to 1 or greater, it'll work just fine -- however that introduces a
timeout/sleep and so the time logging is thrown off.
I've tried using exists() with a 0 second timeout later on and the same thing occurs:
-----
while not anotherRegion.exists(Pattern(screenshot.png).similar(0.60), 0):
pass
print "Print statement outside while loop"
The script gets tossed in an infinite loop if the second argument value
is 0, but if I replace it with a 1, it will exit the loop fine. The
sikuli documentation mentioned that exists() will perform a check even
if the 2nd argument is 0 [you have also mentioned this], but it almost
seems like it didn't have enough time to check the existence of the
image [I'm probably just talking out of my head here]. Is there
something I'm overlooking?
I guess it would be wise for me to post any settings I've modified
through calls in the header of my script.
Settings.ObserveScanRate = 1000.0
Settings.WaitScanRate = 1000.0 #Per suggestion
Settings.DelayAfterDrag = 1.0
Settings.DelayAfterClick = 1.0
Settings.MoveMouseDelay = 1.5
setAutoWaitTimeout(5.0) #For testing purposes, default is 3.0 seconds
------
Running Redhat Linux, Sikuli X-1.0rc3
For the time being, I've reverted back to using observe(), and have
decreased the Region size as suggested to increase the accuracy of the
script. If there are any other possible solutions you can think of,
please feel free to let me know. Thanks for your help =)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.