← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #434360]: Find match exit from pool of images using one if condition

 

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

Description changed to:
Hello,

Below if case is mutually exclusive i.e. only one event will occur in the application.
1. I've to see if any of the even occured, if any match exist within pool of image i.e. event, then I can enter into these condition else I can entirely skip these condition and save time. My application go through these condition 3000 times. Huge loss of time.

if (fr.exists((tempPattern = StaticImages.fn_ImWinClose())) != null) {
			try {
				fr.click(tempPattern);
			} catch (FindFailed e) {
				LogReport.error("Unable to close the dialog");
				e.printStackTrace();
			}
		} else if (fr.exists((tempPattern = StaticImages.fn_ImWinClose1())) != null) {
			try {
				fr.click(tempPattern);
			} catch (FindFailed e) {
				LogReport.error("Unable to close the dialog");
				e.printStackTrace();
			}
		} else if (fr.exists((tempPattern = StaticImages.fn_MinimizeDialog())) != null) {
			try {
				fr.click(tempPattern);
			} catch (FindFailed e) {
				LogReport.error("Unable to minimize the dialog");
				e.printStackTrace();
			}
		} else if (fr.exists(StaticImages.fn_DisabledCloseButtonDialog()) != null) {
			try {
				fr.click(StaticImages.fn_DisabledCloseDialogNoButton());
			} catch (FindFailed e) {
				LogReport.error("Unable to click on NO button on disabled Close button dialog");
				e.printStackTrace();
			}
		}

is below syntax possible ?
fr.exist(image1|| image2|| image3||image4){
     if(fr.exist(image1)) --> do
     else if(fr.exist(image2)) --> do
     else if(fr.exist(image3)) --> do
     else if(fr.exist(image4)) --> do
}

Or any other optimized solution available. Please suggest. Thank you.

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