matt came up with a promising solution–thanks.
Hi, Craig,
I think you’re going to need to adjust the search parameters inside that function in order for this to work. I was going to suggest that you set the searchRectangle property to a smaller area around where you expect to find the image, but I see that you are already doing that.
For the search parameters, I’d add code like this:
// store the current settings
put getOptions() into currentSettings
// reduce the image search delay
setOption imageSearchDelay, .1
// increase the image search count
setOption imageSearchCount, 20
If imageFound(4, image1) then
If imageFound(4, image2) then
// restore the original settings before returning
setOptions currentSettings
Return true
End if
End if
// restore the original settings before returning
setOptions currentSettings
Return false
It might also work to start your search for either image and then search for the other one based on which is found:
if imageFound(4, image1, image2) then
if foundImageInfo().imageName is image1 then
if imagefound(4, image2) then
// restore the original settings before returning
setOptions currentSettings
return true
end if
else
if imagefound(4, image1) then
// restore the original settings before returning
setOptions currentSettings
return true
end if
End if
end if
The processing time should be inconsequential. You could clean this up a bit by having only a single return statement, so the whole thing becomes:
(* Verify that an image is flashing between the two specified images and log appropriately )
on verifyFlash image1, image2, searchRec, pc
( assume correct pc is connected if not given *)
if pc is not empty and pc is not null and pc is not “pc” then
connect pc
end if
(* Constrain the search area as specified *)
if searchRec is empty or searchRec is null or searchRec is "searchRec" then
set searchRec to (0, 0, 2560, 1024)
end if
put getOptions() into currentSettings
// reduce the image search delay
setOption imageSearchDelay, .1
// increase the image search count
setOption imageSearchCount, 20
setOption SearchRectangle, searchRec
set flashingFound to false
(* Detect flashing image *)
if imageFound(4, image1, image2) then
if foundImageInfo().imageName is image1 then
if imagefound(4, image2) then
// restore the original settings before returning
Log "VERIFIED: Flashing" && image1 && "detected"
set flashingFound to true
end if
else
if imagefound(4, image1) then
// restore the original settings before returning
Log "VERIFIED: Flashing" && image1 && "detected"
set flashingFound to true
end if
End if
end if
setOption SearchRectangle, fullscreen
LogError "VERIFICATION FAILURE: Flashing" && image1 && "*NOT* detected"
setOptions currentSettings
return flashingFound
end verifyFlash
I don’t have a flashing image to test this against, so I can’t guarantee it will work. Let me know how it goes.
Regards,
Matt