← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #160030]: String returned from findAll() function are not in order of their occurrence in Screen

 

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

Saorabh Singh posted a new comment:
Hi Raiman,

i am giving few more inputs:
3 images have been attached..Choose.png &Choose1.png are the Images to be
searched in Create_QnA.png Screen.

*please have a look at it & help me.*

JAVA CODE::
String qlist = new String();
 Pattern QTextbox = new Pattern(imagePath + "android/imgs/Choose.png");
QTextbox.similar((float) 0.3);
Iterator<Match> match=s.findAll(QTextbox);
Pattern QTextbox1 = new Pattern(imagePath + "android/imgs/Choose1.png");
QTextbox1.similar((float) 0.3);
Iterator<Match> match1=s.findAll(QTextbox1);
Region Rfind = null;
System.out.println("\n New Serach");
for(int i=0;i<numOfQuestionsToBeCreated;i++)
{
 qlist=match.next().text();
System.out.println("\nStrings : " + qlist);
Rfind =match.next().inside();
System.out.println("Region Returned :"+i+"= " + Rfind);
Rfind.click(QTextbox,0);
if(!match.hasNext())
break;
}
for(int i=0;i<numOfQuestionsToBeCreated;i++)
{
 qlist=match1.next().text();
System.out.println("Strings : " + qlist);
Rfind =match1.next().inside();
System.out.println("\nRegion Returned :"+i+"= " + Rfind);
Rfind.click(QTextbox1,0);
if(!match1.hasNext())
break;
}

Console OUTPUT For Above code::
New Serach

Strings : Choosea question ~

Region Returned :0= Match[677,373 124x14] score=0.97, target=center
Using substitute bounding box at (222,2)->(239,5)
PyramidTemplateMatcher: source is smaller than the target
[log] CLICK on (739,380)

Strings : Choosea question

Region Returned :1= Match[677,332 124x14] score=0.92, target=center
[log] CLICK on (739,339)
PyramidTemplateMatcher: source is smaller than the target
Strings : (`hnnsea nuestinn


Region Returned :0= Match[677,414 109x13] score=0.98, target=center
PyramidTemplateMatcher: source is smaller than the target
[log] CLICK on (731,420)
Strings : fhnncnA nuncrinn


Region Returned :1= Match[677,331 109x13] score=0.92, target=center
PyramidTemplateMatcher: source is smaller than the target
[log] CLICK on (731,337)


Regards,
Saorabh Singh

On Mon, Jun 6, 2011 at 10:51 PM, Saorabh Singh <
question160030@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Your question #160030 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/160030
>
> Saorabh Singh posted a new comment:
>


> Hi Raiman,
>
> I tried, but i am not able to get match_list Sorted.
> So can you please provide me a sample code to get it??
>
> Regards,
> Saorabh Singh
> On Mon, Jun 6, 2011 at 5:36 PM, RaiMan <
> question160030@xxxxxxxxxxxxxxxxxxxxx
> > wrote:
>
> > Your question #160030 on Sikuli changed:
> > https://answers.launchpad.net/sikuli/+question/160030
> >
> >     Status: Open => Answered
> >
> > RaiMan proposed the following answer:
> > on Java level, findAll returns an object of type Iterator<Match>.
> >
> > But neither find nor findAll return strings, they return Match objects,
> > that represent the found regions.
> >
> > So the usage should be:
> >
> > Iterator<Match> matches;
> > matches = s.findAll(  [ANY_IMAGE]  )
> >
> > Now it should be possible to have a for loop that loops through matches.
> >
> > You might sort the matches as needed before regarding to their
> > coordinates (x or y) or other available attributes of a Match object.
> >
> > --
> > If this answers your question, please go to the following page to let us
> > know that it is solved:
> >
> https://answers.launchpad.net/sikuli/+question/160030/+confirm?answer_id=4
> >
> > If you still need help, you can reply to this email or go to the
> > following page to enter your feedback:
> > https://answers.launchpad.net/sikuli/+question/160030
> >
> > You received this question notification because you asked the question.
> >
>
> --
> You received this question notification because you asked the question.
>

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