Class Finder

  • All Implemented Interfaces:
    java.util.Iterator<Match>, org.sikuli.script.Matches

    public class Finder
    extends java.lang.Object
    implements org.sikuli.script.Matches
    • Constructor Summary

      Constructors 
      Constructor Description
      Finder​(ScreenImage simg, Region region)
      Finder for a Region on a ScreenImage
      Finder​(RIBSM inWhat)
      Create a Finder for the given element
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<Match> asList()  
      Match asMatch()  
      static java.lang.String asRegEx​(java.lang.String text)  
      void destroy()  
      java.lang.String find​(java.awt.image.BufferedImage img)
      do a find op with the given image in the Finder's image (hasNext() and next() will reveal possible match results)
      java.lang.String find​(java.lang.String imageOrText)
      do a find op with the given image or the given text in the Finder's image (hasNext() and next() will reveal possible match results)
      java.lang.String find​(Image img)
      do a find op with the given image in the Finder's image (hasNext() and next() will reveal possible match results)
      java.lang.String find​(Pattern aPtn)
      do a find op with the given pattern in the Finder's image (hasNext() and next() will reveal possible match results)
      java.lang.String findAll​(java.lang.String imageOrText)
      do a findAll op with the given image or the given text in the Finder's image (hasNext() and next() will reveal possible match results)
      java.lang.String findAll​(Image img)
      do a findAll op with the given image in the Finder's image (hasNext() and next() will reveal possible match results)
      java.lang.String findAll​(Pattern aPtn)
      do a find op with the given pattern in the Finder's image (hasNext() and next() will reveal possible match results)
      java.lang.String findAllText​(java.lang.String text)
      do a findAll op with the given text in the Finder's image (hasNext() and next() will reveal possible match results)
      java.util.List<Region> findChanges​(java.lang.Object changedImage)  
      boolean findLine​(java.lang.String text)  
      boolean findLines()  
      boolean findLines​(java.lang.String text)  
      java.lang.String findText​(java.lang.String text)
      do a text find with the given text in the Finder's image (hasNext() and next() will reveal possible match results)
      boolean findWord​(java.lang.String text)  
      boolean findWords()  
      boolean findWords​(java.lang.String text)  
      java.util.List<Match> getList()  
      <RI> java.util.List<Match> getListFor​(RI what)  
      static java.util.regex.Pattern getRegEx​(java.lang.String text)  
      boolean hasNext()  
      static boolean isRegEx​(java.lang.String text)  
      Match next()  
      void remove()  
      void resetFindChanges()  
      void setFindChangesImageDiff​(int value)  
      void setFindChangesPixelDiff​(int value)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Constructor Detail

      • Finder

        public Finder​(RIBSM inWhat)
        Create a Finder for the given element
        Type Parameters:
        RIBSM - Region, Image, BufferedImage, ScreenImage, image filename, cvMat
        Parameters:
        inWhat - in what element (RIBS) to search
      • Finder

        public Finder​(ScreenImage simg,
                      Region region)
        Finder for a Region on a ScreenImage
        Parameters:
        simg - ScreenImage
        region - the cropping region
    • Method Detail

      • find

        public java.lang.String find​(java.lang.String imageOrText)
        do a find op with the given image or the given text in the Finder's image (hasNext() and next() will reveal possible match results)
        Parameters:
        imageOrText - image file name or text
        Returns:
        null. if find setup not possible
      • find

        public java.lang.String find​(Pattern aPtn)
        do a find op with the given pattern in the Finder's image (hasNext() and next() will reveal possible match results)
        Parameters:
        aPtn - Pattern
        Returns:
        null. if find setup not possible
      • find

        public java.lang.String find​(Image img)
        do a find op with the given image in the Finder's image (hasNext() and next() will reveal possible match results)
        Parameters:
        img - Image
        Returns:
        null. if find setup not possible
      • find

        public java.lang.String find​(java.awt.image.BufferedImage img)
        do a find op with the given image in the Finder's image (hasNext() and next() will reveal possible match results)
        Parameters:
        img - BufferedImage
        Returns:
        null. if find setup not possible
      • findChanges

        public java.util.List<Region> findChanges​(java.lang.Object changedImage)
      • findAll

        public java.lang.String findAll​(java.lang.String imageOrText)
        do a findAll op with the given image or the given text in the Finder's image (hasNext() and next() will reveal possible match results)
        Parameters:
        imageOrText - iamge file name or text
        Returns:
        null. if find setup not possible
      • findAll

        public java.lang.String findAll​(Pattern aPtn)
        do a find op with the given pattern in the Finder's image (hasNext() and next() will reveal possible match results)
        Parameters:
        aPtn - Pattern
        Returns:
        null. if find setup not possible
      • findAll

        public java.lang.String findAll​(Image img)
        do a findAll op with the given image in the Finder's image (hasNext() and next() will reveal possible match results)
        Parameters:
        img - Image
        Returns:
        null. if find setup not possible
      • findText

        public java.lang.String findText​(java.lang.String text)
        do a text find with the given text in the Finder's image (hasNext() and next() will reveal possible match results)
        Parameters:
        text - text
        Returns:
        null. if find setup not possible
      • findWord

        public boolean findWord​(java.lang.String text)
      • findWords

        public boolean findWords​(java.lang.String text)
      • findWords

        public boolean findWords()
      • findLine

        public boolean findLine​(java.lang.String text)
      • findLines

        public boolean findLines​(java.lang.String text)
      • findLines

        public boolean findLines()
      • findAllText

        public java.lang.String findAllText​(java.lang.String text)
        do a findAll op with the given text in the Finder's image (hasNext() and next() will reveal possible match results)
        Parameters:
        text - text
        Returns:
        null. if find setup not possible
      • asRegEx

        public static java.lang.String asRegEx​(java.lang.String text)
      • isRegEx

        public static boolean isRegEx​(java.lang.String text)
      • getRegEx

        public static java.util.regex.Pattern getRegEx​(java.lang.String text)
      • getList

        public java.util.List<Match> getList()
      • getListFor

        public <RI> java.util.List<Match> getListFor​(RI what)
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<Match>
        Specified by:
        hasNext in interface org.sikuli.script.Matches
        Returns:
        true if Finder has a next match, false otherwise
      • next

        public Match next()
        Specified by:
        next in interface java.util.Iterator<Match>
        Specified by:
        next in interface org.sikuli.script.Matches
        Returns:
        the next match or null
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<Match>
      • destroy

        public void destroy()
      • asMatch

        public Match asMatch()
        Specified by:
        asMatch in interface org.sikuli.script.Matches
      • asList

        public java.util.List<Match> asList()
        Specified by:
        asList in interface org.sikuli.script.Matches
      • resetFindChanges

        public void resetFindChanges()
      • setFindChangesPixelDiff

        public void setFindChangesPixelDiff​(int value)
      • setFindChangesImageDiff

        public void setFindChangesImageDiff​(int value)