This script is used if we want to detect if any activity(ies) happen in monitor using Sikuli. The idea is simple:
1. Capture the screen,
2. Take another capture after certain time interval
3. Compare the second capture to the first
4. Delete temporary image
Here is the script (I use python script)
1. Capture the screen,
2. Take another capture after certain time interval
3. Compare the second capture to the first
4. Delete temporary image
Here is the script (I use python script)
def activityDetected():
screen = Screen()
while True:
file = screen.capture(screen.getBounds())
sleep(2)
file2 = screen.capture(screen.getBounds())
f = Finder(file)
f.find(Pattern(file2).exact())
matchVal = f.hasNext()
f.destroy()Hope this helps you.
os.remove(file)
os.remove(file2)
if matchVal:
return False
else:
return True
Comments