Question #254721 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/254721
Status: Open => Answered
RaiMan proposed the following answer:
early enough ??? LOL
In your program there are some problems:
- if one of the find() ops crash, your exists switch will never be entered (the
catch block is executed)
- a, b, c, … are all Match objects, but exists() must be run with an image
- the find() are not necessary in this setup
this is my suggestion:
import org.sikuli.script.*;
public class AuthenticationHandler {
public static void main(String[] args) {
Screen s = new Screen();
String dir =
"D:/ScriptFiles/Workspace/SikuliTest/src/Authentication/";
String b = dir + "1410953555965.png";
String c = dir + "1410952744291.png";
String d = dir + "1410953428209.png";
String a = dir + "1410953400598.png";
String e = dir + "1411044859010.png";
String f = dir + "1411044859011.png";
try {
if (s.exists(a) != null) {
System.out.println("1st");
s.type(b, "clinique");
s.type(c, "dfdsf");
s.click(d);
} else if (s.exists(e) != null) {
System.out.println("2nd");
s.type(b, "mac");
s.type(c, "asdssa");
s.click(d);
} else if (s.exists(f) != null) {
System.out.println("3rd");
s.type(b, "mac");
s.type(c, "asdssa");
s.click(d);
}
} catch (FindFailed ff) {
ff.printStackTrace();
}
}
}
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.
_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help : https://help.launchpad.net/ListHelp