Unable to understand region Behaviour

Asked by Saorabh Singh

I am Using Sikuli in JAVA

Few Doubts Related to Region::
--------------------------------------------------------
1)
Creating new region..
Suppose i want to create a Region with Some fixed values...
How can i do it??
I tried this way...
Region R;
R.x=100;R.y=200;R.h=500;R.w=600

But its not working..gives Error that R is not initilized & if i Initilize it to null then while assigning coordinates...
It gives Error..cant assin value to null.

2)
r is a region with some value, Say r(300,1200)h=100 & w=1500
now i create a copy of Region r
Region select=r;
& make some Alteration in select region.
select.h=5;select.x=select.x-2;select.y=100;

But when i check the value of Region r ...
the changes made in Region select are reflected in Region r.
ie value of both Region r & select are same.

Which was not expected(for me)..
So how to Solve this??

3) Need to understand behavior of Region.Below() function
Just explain.. What is @Screen(0) E:Y, T:3.0 ?? (Look below Sample code & Output)

CODE:
System.out.println("Value OF region r "+r);
Region select=r.below();
System.out.println("Value OF region Select "+select);

O/P:
------
Value OF region r Match[999,462 53x49] score=0.96, target=center
Value OF region Select Region[999,511 53x257]@Screen(0) E:Y, T:3.0

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
eliteSKL (camaro70s) said :
#1

1)

Region takes 4 arguments. so Region(100,200,500,600)

or

r=[100,200,500,600]
Region(*r)

Revision history for this message
eliteSKL (camaro70s) said :
#2

oops.... didn't see that you said in "Java". Sorry nvm my responose.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

--- at 1:
I guess:
Region R = new Region(100,200,500,600);

--- at 2:
that is basic OO knowledge ;-)

Region select=r;

does not make a copy it only duplicates the object reference.

this makes a copy:

Region select = new Region(r);

--- at 3:
@Screen(0) --- region is on Screen(0) (should be primary monitor)
E:Y --- if not found in this region, FindFailed exception is thrown
T:3.0 --- autoWaitTimeout for this region currently is 3 seconds (the default)

Revision history for this message
RaiMan (raimund-hocke) said :
#4

or use
Region select = r.inside();

to make a copy, because all these spatial operators return a new Region object.

Revision history for this message
Saorabh Singh (kunnu30) said :
#5

Thanks a lot Raiman,

As per my understanding r.below() gives new region below region r..So
can you Explain in detail the use or Significance of these values....will these can used in any scenario??

E:Y --- if not found in this region, FindFailed exception is thrown
T:3.0 --- autoWaitTimeout for this region currently is 3 seconds (the default)
like..autoWaitTimeout for what???

Revision history for this message
Best RaiMan (raimund-hocke) said :
#6

it simply represents the current internal state of the respective object.

E:Y --- can be manipulated with Region.setThrowException()
T:3.0 --- can be manipulated with Region.setAutoWaitTimeout()

sometimes it helps to look into the docs:
general and Jython: http://sikuli.org/docx/index.html
sikuli-script JavaDoc: http://sikuli.org/doc/java-x/

Revision history for this message
Saorabh Singh (kunnu30) said :
#7

Thanks a lot..
You are Awesome.

On Thu, Jun 16, 2011 at 10:45 PM, RaiMan <
<email address hidden>> wrote:

> Your question #161673 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/161673
>
> Status: Open => Answered
>
> RaiMan proposed the following answer:
> it simply represents the current internal state of the respective
> object.
>
> E:Y --- can be manipulated with Region.setThrowException()
> T:3.0 --- can be manipulated with Region.setAutoWaitTimeout()
>
> sometimes it helps to look into the docs:
> general and Jython: http://sikuli.org/docx/index.html
> sikuli-script JavaDoc: http://sikuli.org/doc/java-x/
>
> --
> 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/161673/+confirm?answer_id=5
>
> 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/161673
>
> You received this question notification because you asked the question.
>

Revision history for this message
Saorabh Singh (kunnu30) said :
#8

Thanks RaiMan, that solved my question.