There are at least two ways to compare two screenshots of the SUT. The first is to capture the original image and then search for it again later, possibly using a searchRectangle to look only in the place where you expect it to appear. If it is found then you can log success.
The other approach is to capture the same area of the screen at two different times into two image files and compare those files. Here’s how it would look:
set areaOfInterest to (100,100,300,300) -- the area of the screen to compare
captureScreen "/tmp/originalImage", areaOfInterest
-- do some other processing
captureScreen "/tmp/laterImage", areaOfInterest -- capture the same area again
if file "/tmp/originalImage.tiff" as data is equal to file "/tmp/laterImage.tiff" as data then
logSuccess "The images are the same"
logFailure "The images are different"
Note that if you’re running on Windows or Linux the images will be captured as .png files not .tiff, and on Windows you’ll need to store them in a different directory, not /tmp. But if you’re careful to get the image file names correct, this approach should work. It’s also important that you compare the files “as data” so SenseTalk won’t try to convert them to text strings which would give unreliable results when comparing binary data.