Here is a example of Sikuli script
while (exists("OK.png"),10):
click("OK.png")
How can I do the same in Java?
Here is what I tried:
Screen screen = new Screen();
Pattern image = new Pattern("OK.png");
while (screen.exists(image))
{
screen.click(image);
}
But it is failing to compile with this exception:
java: SikuliTest.java:29: incompatible types
found : org.sikuli.script.Match
required: boolean
Can anyone provide the correct syntax?
According to the documentation, exists()
returns a Match
object if the image was matched, or null
otherwise. Try this:
while (screen.exists(image) != null)