← Back to team overview

sikuli-driver team mailing list archive

[Question #666773]: findAnyList() in Java

 

New question #666773 on Sikuli:
https://answers.launchpad.net/sikuli/+question/666773

Hello,

I am new to coding in general and currently learning Java. I have a little project where which I'm using to learn and came across this piece of python code in one of the question here. I want to transfer this to java, I have tried finding code examples online but all I can find is very complex example far beyond my learning level or python examples. Furthermore the sikuli documentation I could find seems to be written for people who already know how to code.

r = regionOfTheScreen
r.setAutoWaitTimeout(0)
images = [p0.png, p1.png, p2.png, etc]
while True:
    matches = a.findAnyList(images)
    for match in matches:
         click("r"+str(match.getIndex())+".png")

I want to do the same in Java but I am stuck. So far I have:

Region totalRollArea = new Region(20, 20, 100, 50);
		
		Match number1 = new Match("number1.png");
		Match number2 = new Match("number2.png");
		Match[] numbers = {number1, number2};
		totalRollArea.findAnyList("number1.png", "numbers.png");    // This part im quite certain of
		
		for (int i = 1; :i++) {
			if (totalRollArea.exist(numbers [1]));    // ???
			
		}
		return indexValue;

I am unsure about how to use the array (do I need it? the documentation for sikuli 1.1x+ doesnt mention it) and how to iterate over it using the List/Array.

Any help would be greatly appreciated as it helps me a lot in learning the language.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.