@@ -0,0 +1,1390 @@
+/**%0AKhalid Alharbi%0A*/%0Apackage org.sikuli.slides.sikuli;%0A%0Aimport java.util.List;%0A%0Aimport org.sikuli.api.DesktopScreenRegion;%0Aimport org.sikuli.api.ImageTarget;%0Aimport org.sikuli.api.ScreenRegion;%0Aimport org.sikuli.slides.screenshots.SlideTargetRegion;%0A%0A/**%0A * Search for multiple occurrences of a target on the screen.%0A * %0A * @author Khalid Alharbi%0A */%0Apublic class SearchMultipleTarget %7B%0A%0A%09%0A%09/**%0A%09 * Check if the screen has multiple occurrences of the Target image.%0A%09 * @param imageTarget the target image to search for.%0A%09 * @return returns true if the screen contains multiple occurrences of the target image (similar targets).%0A%09 */%0A%09public boolean hasMultipleOccurance(ImageTarget imageTarget)%7B%0A%09%09ScreenRegion fullScreenRegion=new DesktopScreenRegion();%0A%09%09List%3CScreenRegion%3E targetList=fullScreenRegion.findAll(imageTarget);%0A%09%09if(targetList!=null && targetList.size()%3E1)%7B%0A%09%09%09return true;%0A%09%09%7D%0A%09%09else%7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%7D%0A%09/**%0A%09 * finds the new screen region that only contains the target image.%0A%09 * @return the screen region that only contains the target image.%0A%09 */%0A%09public ScreenRegion findNewScreenRegion(SlideTargetRegion slideTargetRegion,ImageTarget imageTarget)%7B%0A%09%09RegionSelector regionSelector=new RegionSelector(slideTargetRegion);%0A%09%09ScreenRegion newScreenRegion=regionSelector.findScreenRegion(imageTarget,slideTargetRegion);%0A%09%09return newScreenRegion.find(imageTarget);%0A%09%7D%0A%7D%0A

add search for multiple occurrences of a target on the screen