← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #268579]: Java API - How to sort matches in Java IDE

 

Question #268579 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/268579

    Status: Answered => Solved

Maks confirmed that the question is solved:
Thanks, RaiMan.
It works perfect! Have a nice day.


Working code:

           Clicker.java:
package sikuli;

import org.sikuli.script.FindFailed;
import org.sikuli.script.Match;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;

public class Clicker {
    static Screen scr1 = new Screen(1);
    static String path = "images.sikuli\\plus.png";
    static Pattern pat = new Pattern(path).similar(0.95f);
    static int count = 0;
    public static void clicker(){
        try{
           for (int i = 0; i < scr1.findAllByColumn(pat).length - 1; i++) {
                count++;
                Match m = scr1.findAllByColumn(pat)[i];
                System.out.println(m);
                scr1.click(m);
                clicker();
               break;
            }
        }
        catch(FindFailed e){
            e.printStackTrace();
        }
    }
}


           Sikuli.java:
package sikuli;

import java.io.File;

import org.sikuli.basics.Debug;
import org.sikuli.script.*;

public class Sikuli {
    public static void main(String[] args) throws FindFailed{
       Clicker.clicker();
       System.out.println(Clicker.count);
    }
}

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.