Package org.sikuli.api

Examples of org.sikuli.api.ScreenRegion


//    };
   
    ImageExplainer.getExplainer(TextMap.class).setLevel(Level.ALL);
    ImageExplainer.getExplainer(TextTarget.class).setLevel(Level.ALL);
   
    ScreenRegion s = new DesktopScreenRegion();
    String[] stringsToFind = new String[]{
        //"TRANSFER",
        //"DIVIDEND",
        "Account Balance",
        "$4,021.77",
        "$0.30",
        "$3,000.00",
        "$0.25",
        "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


  };

  public static void main(String[] args) throws MalformedURLException {
    simulator.start();   

    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));

    imageURL = Images.GoogleMicrophoneIcon;               
    imageTarget = new ImageTarget(imageURL);         
    r = s.find(imageTarget);            
    mouse.rightClick(r.getCenter());

    canvas.clear().addBox(r);
    canvas.displayWhile(new SpeakerPlayable(clickhere));

    imageURL = Images.GoogleSearchFeelingLuckyButton;               
    imageTarget = new ImageTarget(imageURL);         
    r = s.find(imageTarget);
    mouse.doubleClick(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");

    canvas.addBox(Relative.to(r).left(100).getScreenRegion());
View Full Code Here

    simulator.start();
    ImageExplainer.getExplainer(VisualModelFinder.class).setLevel(Level.STEP);
   
    Rectangle b = simulator.getBounds();
    ScreenRegion s = new DesktopScreenRegion(b.x,b.y,b.width,b.height);

    StyledRectangleTarget target = new StyledRectangleTarget(Images.CalculatorButton);
//    Target target = new StyledRectangleTarget(new URL("file:wally.png"));
//    Target target = new ImageTarget(Images.CalculatorButton);
    target.setLimit(20);
   
    List<ScreenRegion> rs = s.findAll(target);
   
       
    for (ScreenRegion r : rs){
      canvas.addBox(r);
    }
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);
      String labelText = String.format("(%d):%1.3f", no, r.getScore());
      canvas.addLabel(r, labelText);
View Full Code Here

    double topScore = 0;

    Map<Target, Object> states = screenRegion.getStates();   
    Set<Target> keySet = states.keySet();   
    for (Target target : keySet){ 
      ScreenRegion match = screenRegion.find(target);
      if (match != null && match.getScore() > topScore){
        topStateTarget = target;
        topScore = match.getScore();
      }     
    }


    // if the current top state target is the same as the one before
View Full Code Here

  };

  public static void main(String[] args) throws IOException {
    simulator.start();

    ScreenRegion s = new DesktopScreenRegion();
   
    Target imageTarget = new ImageTarget(Images.ThumbIcon);

    ScreenRegion thumb = s.find(imageTarget);

    ScreenRegionCanvas canvas = new ScreenRegionCanvas(s);
    canvas.addBox(thumb);
    canvas.addLabel(Relative.to(thumb).topLeft().above(20).getScreenLocation(), "ImageTarget:");
    canvas.addImage(Relative.to(thumb).topLeft().above(25).right(85).getScreenLocation(), ImageIO.read(Images.ThumbIcon));
View Full Code Here

  final private TargetEventListener listener;
  private ScreenRegion lastTargetRegion;


  public void run(){
    ScreenRegion currentTargetRegion = null;
    if (lastTargetRegion == null){         

      currentTargetRegion = screenRegion.find(target);
      if (currentTargetRegion != null){
        // appear
View Full Code Here

    if (lastTargetRegion == null)
      return false;

    // TODO: only need to find in a small area around the last location
    ScreenRegion r = screenRegion.find(target);
    if (r == null)
      return false;   

    ScreenLocation newLocation = Relative.to(r).topLeft().getScreenLocation();
    ScreenLocation lastLocation = Relative.to(lastTargetRegion).topLeft().getScreenLocation();
View Full Code Here

  public static void main(String[] args) {
    simulator.start();   

    // Obtain the screen region object corresponding to the
    // default monitor in full screen
    ScreenRegion s = new DesktopScreenRegion()
   
    // Define an image target on the screen
    URL imageURL = Images.GoogleSearchButton;               
    Target imageTarget = new ImageTarget(imageURL);
    // Issue the find command and get a new screen region
    // 'r' corresponding to the screen region occupied
    // by the found target
    ScreenRegion r = s.find(imageTarget);   
    // Click the center of 'r'   
    mouse.click(r.getCenter());   
    // Display a box around 'r' for 1 second
    canvas.addBox(r).display(1);

    // Find another image target and perform similar operations
    imageURL = Images.GoogleMicrophoneIcon;               
    imageTarget = new ImageTarget(imageURL);         
    r = s.find(imageTarget);            
    mouse.rightClick(r.getCenter());
    canvas.clear().addBox(r).display(1);

    // Find another image target and perform similar operations
    imageURL = Images.GoogleSearchFeelingLuckyButton;               
    imageTarget = new ImageTarget(imageURL);         
    r = s.find(imageTarget);
    mouse.doubleClick(r.getCenter());
    canvas.clear().addBox(r).display(1);

  }
View Full Code Here

TOP

Related Classes of org.sikuli.api.ScreenRegion

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.