sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #35288
Re: [Question #272241]: Help to click on image based on text info observed
Question #272241 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/272241
Status: Answered => Solved
Saravanakumar confirmed that the question is solved:
Dear Raiman,
Good Day. I trust this message should bring smiles. Thank you for
helping me out with you code blocks and directions to solve my problem.
Below is my code snippet written in Java _ Sikuli1.1X
public int MonitorAppletScreen(){
int retryCount = 1;
int status = 0; // 0 means failure; 1 means success
Settings.OcrTextRead = true;
Settings.OcrTextSearch = true;
int outerLoop = 0;
//System.out.println("Inside MonitorAppletScreen method");
SetMouseCursorDefaultLocation();
try{
appletScreen = new Screen();
int x = (appletScreen.w) / 2;
int y = (appletScreen.h) / 2;
loc = new Location(x, y);
appletScreen.hover(loc);
appletScreen.wait(1.0);
//while(outerLoop < 10){
//SK:: ROW WISE - START
while(retryCount <= 2){
if(retryCount == 1){
m = appletScreen.findText("Idle");
m.hover();
r = m.add(0, 361, 15, 10);
img = r.find("img/ESRSrun.PNG");
appletScreen.wait(1.0);
img.click();
appletScreen.wait(1.0);
}else{
m = m.below().findText("Idle");
m.hover();
r = m.add(0, 361, 15, 10);
img = r.find("img/ESRSrun.PNG");
appletScreen.wait(1.0);
img.click();
appletScreen.wait(1.0);
}
Thread.sleep(1500);
retryCount = retryCount + 1;
}
//SK:: ROW WISE - END
retryCount = 1;
outerLoop = outerLoop + 1;
Reset();
appletScreen = new Screen();
loc = new Location(60, 60);
appletScreen.hover(loc);
appletScreen.wait(1.0);
//}
}catch(Exception ex){
status = 0;
//ex.printStackTrace();
//System.out.println(".........................................................................");
//System.out.println("Exception occurred in MonitorAppletScreen method" + ex.getMessage());
}
return (status);
}
BTW - The FindAllText was not working with current version. Hence I
found a way out using positional (below() method) mechanisms.
Thank you so much for your support.
Saravanakumar
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.