Question #668045 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/668045
Status: Answered => Open
Payam Fard is still having a problem:
Thanks for your response. I tried grow(), and it is better, but for some
reason, it is reading a strange additional character and removing a character.
Basically, with the example below, I am opening up Wordpad and based on the
image of "Home" menu on top, I am trying to read "View" menu into the value
variable. For some reason, without the addition of grow(), it was reading "Vie"
and now with the addition of grow, it is reading "Vie
E" instead of "View".
Not sure why "w" is not being read and not sure where "E" on the second
line is coming from. Any thoughts?
[code]
import java.util.Iterator;
import org.sikuli.basics.Debug;
import org.sikuli.basics.Settings;
import org.sikuli.script.*;
public class TestSikuli {
public static void main(String[] args) throws InterruptedException {
Screen s = new Screen();
Debug.setDebugLevel(3);
Settings setting = new Settings();
setting.OcrTextSearch = true;
setting.OcrTextRead = true;
try{
App region = App.open("C:\\Program Files\\Windows
NT\\Accessories\\wordpad.exe");
Region appRegion = region.focusedWindow();
appRegion.highlight(1);
// get the project folder absolute path
String workingDir = System.getProperty("user.dir");
ImagePath.add(TestSikuli.class.getCanonicalName() + "/images");
String imagesPath = workingDir + "\\images\\";
System.out.println("images path is " + imagesPath);
Screen objScreen = new Screen();
objScreen.type("Hello, Sikuli!");
Iterator<Match> matchedObjects =
objScreen.findAllText("Sikuli");
Match singleMatch = null;
if(matchedObjects.hasNext()) {
System.out.println("------------------- Inside if #1
-----------------------");
singleMatch = matchedObjects.next();
System.out.println("------------------- Found object is
: " + singleMatch.text());
}
Iterator<Match> matchedObjects1 =
objScreen.findAllText("Paint");
Match singleMatch1 = null;
if(matchedObjects1.hasNext()) {
System.out.println("------------------- Inside if #2
-----------------------");
singleMatch1 = matchedObjects1.next();
System.out.println("------------------- Found object is
: " + singleMatch1.text());
}
objScreen.wait(imagesPath + "home.PNG").offset(50,
0).grow(25,0).click();
String value = objScreen.wait(imagesPath +
"home.PNG").offset(50, 0).grow(25,0).text();
System.out.println("------------------- Value is
-----------------------" + value);
}
catch(FindFailed e){
e.printStackTrace();
}
}
}
[/code]
--
You received this question notification because your team Sikuli Drivers
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