Package org.sikuli.api

Examples of org.sikuli.api.Target


    simulator.start();
   
    Rectangle b = simulator.getBounds();
    ScreenRegion s = new DesktopScreenRegion(b.x,b.y,b.width,b.height)

    Target target;
    List<ScreenRegion> rs;

    // find all unchecked checkboxes ordered from bottom to top 
   
    target = new ImageTarget(Images.UncheckedCheckbox);
    target.setLimit(15);
    target.setOrdering(Target.Ordering.BOTTOM_UP);
   
    rs = s.findAll(target);
   
    canvas.addLabel(Relative.to(s).topLeft().getScreenLocation(), "Unchecked checkboxes found in bottom-up ordering");
    for (int i=0; i < rs.size(); ++i){
      ScreenRegion r = rs.get(i);
      canvas.addBox(r);
      canvas.addLabel(Relative.to(r).topLeft().left(20).getScreenLocation(), ""+(i+1));
    }
    canvas.display(5);
       
    // find all styled rectangles (e.g., buttons) ordered from left to right
 
    target = new StyledRectangleTarget(Images.ButtonOptions);
    target.setOrdering(Target.Ordering.LEFT_RIGHT);
   
    rs = s.findAll(target);
   
    canvas.clear().addLabel(Relative.to(s).topLeft().getScreenLocation(), "Rectangles found in left-right ordering");
    for (int i=0; i < rs.size(); ++i){
View Full Code Here


   
    canvas.addBox(s);
    canvas.addLabel(Relative.to(s).topLeft().getScreenLocation(), "Observed region");
    canvas.display(2);
   
    Target target = new ForegroundTarget();
    ScreenRegion r = s.find(target);   
   
    canvas.clear();
    canvas.addBox(r);
    canvas.addLabel(Relative.to(s).topLeft().getScreenLocation(), "find");
View Full Code Here

    simulator.start();            
    Rectangle b = simulator.getBounds();
    ScreenRegion s = new DesktopScreenRegion(b.x, b.y, b.width, b.height);

    List<ScreenRegion> rs;
    Target target = new ImageTarget(Images.HollowRedStar);
    target.setOrdering(Ordering.LEFT_RIGHT);
    rs = s.findAll(target);         

    ScreenRegion left = rs.get(0);
    ScreenRegion right = rs.get(1);
View Full Code Here

    final DesktopScreenRegion s = new DesktopScreenRegion(b.x, b.y, b.width, b.height);


    // Finding color stars

    Target blueTarget = new ColorImageTarget(Images.BlueStar);
    Target redTarget = new ColorImageTarget(Images.RedStar);
    Target greenTarget = new ColorImageTarget(Images.GreenStar);

    List<ScreenRegion> blueTargetRegions = s.findAll(blueTarget);
    List<ScreenRegion> greenTargetRegions = s.findAll(greenTarget);
    List<ScreenRegion> redTargetRegions = s.findAll(redTarget);
   
View Full Code Here

    simulator.start();

    ScreenRegion s = new DesktopScreenRegion();

    URL imageURL = Images.OSXDockIcon;               
    Target imageTarget = new ImageTarget(imageURL);

    ScreenRegion r = s.find(imageTarget);
    mouse.click(r.getCenter());   

    imageURL = Images.ThumbIcon;               
View Full Code Here

        "22296"
    };

    // Find each string and display a box and a text label
    for (String stringToFind : stringsToFind){   
      Target textTarget = new TextTarget(stringToFind);
      ScreenRegion r = s.find(textTarget);
      canvas.addBox(r);
      canvas.addLabel(r, stringToFind);   
    }   
    canvas.display(5);
View Full Code Here

    ScreenRegion s = new DesktopScreenRegion()
   
    URL clickhere = SpeakerExample.class.getResource("clickhere.wav");
   
    URL imageURL = Images.GoogleSearchButton;               
    Target imageTarget = new ImageTarget(imageURL);
    ScreenRegion r = s.find(imageTarget);   
    mouse.click(r.getCenter());   
   
    canvas.clear().addBox(r);
    canvas.displayWhile(new SpeakerPlayable(clickhere));
View Full Code Here

  public static void main(String[] args) {
    simulator.start();   
    ScreenRegion s = new DesktopScreenRegion();     
    URL imageURL = Images.GoogleSearchButton;               
    Target imageTarget = new ImageTarget(imageURL);
    ScreenRegion r = s.find(imageTarget);   
   
    canvas.addBox(Relative.to(r).right(100).getScreenRegion());
    canvas.addLabel(Relative.to(r).right(100).center().getScreenLocation(), "right");
View Full Code Here

 
  public static void main(String[] args) {
    simulator.start();
   
    ScreenRegion s = new DesktopScreenRegion();
    Target imageTarget = new ImageTarget(Images.ThumbIcon);
 
    List<ScreenRegion> rs = s.findAll(imageTarget);
    int no = 1;
    for (ScreenRegion r : rs){
      canvas.addBox(r);
View Full Code Here

  private Target previousStateTarget = null;

  @Override
  public void run() {

    Target topStateTarget = null;
    double topScore = 0;

    Map<Target, Object> states = screenRegion.getStates();   
    Set<Target> keySet = states.keySet();   
    for (Target target : keySet){ 
View Full Code Here

TOP

Related Classes of org.sikuli.api.Target

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.