Comment 7 for bug 1434434

Revision history for this message
RaiMan (raimund-hocke) wrote :

@Brian
Thanks for the reminder ;-)
Always wanted to implement something, that avoids this (ugly) coding.

From tomorrow's build 1.1.0 on this will do what you have done:
(no need to import anything)

r = selectRegion()
img = r.saveCapture(getBundlePath()) # the initial capture
while True:
  while r.exists(Pattern(img).similar(0.99), 0):
    wait(1)
    if Mouse.at().x < 10:
      exit()
    wait(1)
  img = r.saveCapture(getBundlePath()) # the follow-up capture after a change

I added a termination solution:
if you move the mouse to the screen's left edge, the script will terminate.

absolute-path-of-imagefile = r.saveCapture( [path [ , name ] ] )

will save timestamped .png files as:
nothing given: <temp>/Sikulix/sikuliximage-1427279736087.png
path given: <path>/sikuliximage-1427279736087.png
path and name given: <path>/<name>-1427279736087.png

and return the absolute path of the created .png or "" if failed for some reason.