← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #191821]: How to define an AppearEvent in java

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- in Java e.g.
s = new Screen();

// Match ended
SikuliEventAdapter myHandler = new SikuliEventAdapter {
    public void targetAppeared (AppearEvent evnt) {
        System.out.println("targetChanged called");
	evnt.match.highlight(1);
        s.click("1313262381063.png");
	evnt.region.stopObserver();
    }
}

// Match didn't end
SikuliEventAdapter myHandler2 = new SikuliEventAdapter {
    public void targetAppeared (AppearEvent evnt) {
        System.out.println("targetChanged called");
	evnt.match.highlight(1);
        s.click("E.png");
	evnt.region.stopObserver();
    }
}

// some code not specific for observe
//.....

s.onAppear("1313273123506.png", myHandler);
s.onAppear("III.png", myHandler2);
s.observe(20.0);

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