← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #146397]: How to chcek weather images exist in screen or not., how to declare match varibale in java

 

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

RaiMan posted a new comment:
Interesting transformation ;-)

In this context here, when talking about a match, it is the Match object
returned by a find operation. And a Pattern is an object, that contains
the image filename, the needed min. similarity to find and a target
offset.

It might be helpful to have a look at the docs at
http://sikuli.org/docx/ and read at least through the class description
intros ;-)

Your implementation works, sure, but besides the 2 click()'s, there is
nothing, that makes sense from the Sikuli view.

This is how based on your question, what you need:

// let the normal notFoundSituation be handled by Java
public static void launchApplication() throws FindFailed
  {
   Screen s=new Screen();

   img1 = "1296729896349.png"
   imgBrowse = "Browse.png"

    if (s.exists(img1))
    {
     s.click(img1,0);
     // alternatively avoids a new find: s.click(s.getLastMatch())
     System.out.print ("hello world");
     s.click(s.exists(imgBrowse,10),0);
     // waits max 10 seconds for the image, if it does not come up, just does nothing: click(null,0)
    }
    else
    {
         System.out.print ("hello NotFound-Hell");
    }
  }

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.