← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #164774]: How to use Sikuli Script in your JAVA programs

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- This works for me:

import org.sikuli.script.*;

public class TestSikuli {

	public static void main(String[] args) throws FindFailed{
		
		Screen s = new Screen();
		s.click("imgs/ViewPlaylist.png", 0);
		Match m = s.getLastMatch();
		m.highlight(2);
}}

--- and produces console output:
[info] Sikuli vision engine loaded.
[log] CLICK on (105,132)
[log] highlight Match[50,101 111x63] score=1,00, target=center for 2.0 secs
[info] Mac OS X utilities loaded.

--- possible reasons if it is not running:
-- imgs/ViewPlaylist.png: the folder imgs has to be in the same folder as the projects src folder (working directory)
-- at runtime of the snippet ViewPlaylist.png must be visible on screen (e.g. not be hidden behind the Eclipse window)

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