[Sikuli-driver] [Question #270582]: Problems setting Setting.WaitScanRate in Sikuli 1.0.1

2015-08-20 Thread joseytw
New question #270582 on Sikuli:
https://answers.launchpad.net/sikuli/+question/270582

Hello, 

I have searched the forums and while I have read posts that seem to apply to 
the problem I am having, I can not nail down a workable solution.  I am using 
Sikuli 1.0.1, and I am coding in Java on a Windows 7 machine.  I am also fairly 
new to coding in Java and using Sikuli.

My problem is this:  

I have an array of 10 small images (10x15 pixles in size) that I iterate 
through looking for a match using r.exists and when a match NOT found there 
seems to be a delay of ~300 ms before the next check is made.

Here is the code:

int i =0;
for(Pattern p : pNumberArray){
if(r.exists(p.similar(.9f), 0) != null){
System.out.println(library.getTime() +  Image Found:  + p);
return i;
}
System.out.println(library.getTime() +  Image not found:  + p);
i++;
}

Here is the result when I run the above code.

12:19:01:032 Image not found 
12:19:01:365 Image not found 
12:19:01:698 Image not found
12:19:02:031 Image not found
12:19:02:364 Image not found 
12:19:02:697 Image not found

I was hoping using a 0 for (r.exists(p/similar(.9f), 0) would fix the 300ms 
delay problem but it does not.

I then read up on 'Settings.AutoWaitTimeout' 
(https://answers.launchpad.net/sikuli/+question/251337) but ruled it out as not 
applicable in my case.  As I understand it, using the 0 in 
(r.exists(p/similar(.9f), 0) forces a one time check of the image and 
immediately returns the match if found or NULL if not 
(https://answers.launchpad.net/sikuli/+question/251337), so there should be NO 
delay in a response whether an image is found or not.

Searching forum posts turned me on to 'Settings.ScanRate' 
(https://answers.launchpad.net/sikuli/+question/194144) so I tried setting 
'Settings.WaitScanRate = 100;' so that it would search for a match for no more 
than .01 seconds and return the result, but changing that setting had no 
effect.  I also tried a variety of values including, 500, 1, .1f, and .01f but 
the results when running the code above was always the same with ~300 ms delay.

So all that being said, that leads to my questions:
1) I assumed that setting the timeout to 0 when using exists on a region 
(r.exists(p/similar(.9f), 0) would result in NO delay in a response whether an 
image is found or not.  That is not the case.  Why is there a ~300 when the 
timeout is set to 0?

2) I assumed that setting 'Settings.WaitScanRate = 100;' would force a search 
result at the end of .01 seconds.  It does not.  Am I missing something about 
how this works?

3) One post I read mentioned that there used to be an issue setting the values 
of Settings fields wouldn't work because the variables used a 'protected' 
modifier, but I can change the value and see the results of modifying the value 
between 'Settings.MoveMouseDelay = 1;' and 'Settings.MoveMouseDelay = 0;' so 
that leads me to believe that I can change the value of Settings fields.  Is 
the 'Settings.WaitScanRate' indeed a protected variable and one that I cannot 
change?

I spent hours and hours and hours reading forum posts and experimenting with 
different code combinations but I can't get rid of the ~300ms delay when an 
image is NOT found.

Thanks in advance for any wise words of wisdom!

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #270582]: What can I do to prevent a ~300ms delay when an image is NOT found? (Sikuli 1.0.1, Java, Windows)

2015-08-20 Thread joseytw
Question #270582 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/270582

Summary changed to:
What can I do to prevent a ~300ms delay when an image is NOT found? (Sikuli 
1.0.1, Java, Windows)

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #270582]: What can I do to prevent a ~300ms delay when an image is NOT found? (Sikuli 1.0.1, Java, Windows)

2015-08-20 Thread joseytw
Question #270582 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/270582

Description changed to:
Hello,

I have searched the forums and while I have read posts that seem to
apply to the problem I am having, I can not nail down a workable
solution.  I am using Sikuli 1.0.1, and I am coding in Java on a Windows
7 machine.  I am also fairly new to coding in Java and using Sikuli.

My problem is this:

I have an array of 10 small images (10x15 pixles in size) that I iterate
through looking for a match using r.exists (the region is 12x17 pixels)
and when a match NOT found there seems to be a delay of ~300 ms before
the next check is made.

Here is the code:

int i =0;
for(Pattern p : pNumberArray){
if(r.exists(p.similar(.9f), 0) != null){
System.out.println(library.getTime() +  Image Found:  + p);
return i;
}
System.out.println(library.getTime() +  Image not found:  + p);
i++;
}

Here is the result when I run the above code.

12:19:01:032 Image not found 
12:19:01:365 Image not found 
12:19:01:698 Image not found
12:19:02:031 Image not found
12:19:02:364 Image not found 
12:19:02:697 Image not found

I was hoping using a 0 for (r.exists(p/similar(.9f), 0) would fix the
300ms delay problem but it does not.

I then read up on 'Settings.AutoWaitTimeout'
(https://answers.launchpad.net/sikuli/+question/251337) but ruled it out
as not applicable in my case.  As I understand it, using the 0 in
(r.exists(p/similar(.9f), 0) forces a one time check of the image and
immediately returns the match if found or NULL if not
(https://answers.launchpad.net/sikuli/+question/251337), so there should
be NO delay in a response whether an image is found or not.

Searching forum posts turned me on to 'Settings.ScanRate'
(https://answers.launchpad.net/sikuli/+question/194144) so I tried
setting 'Settings.WaitScanRate = 100;' so that it would search for a
match for no more than .01 seconds and return the result, but changing
that setting had no effect.  I also tried a variety of values including,
500, 1, .1f, and .01f but the results when running the code above was
always the same with ~300 ms delay.

So all that being said, that leads to my questions:
1) I assumed that setting the timeout to 0 when using exists on a region 
(r.exists(p/similar(.9f), 0) would result in NO delay in a response whether an 
image is found or not.  That is not the case.  Why is there a ~300 when the 
timeout is set to 0?

2) I assumed that setting 'Settings.WaitScanRate = 100;' would force a
search result at the end of .01 seconds.  It does not.  Am I missing
something about how this works?

3) One post I read mentioned that there used to be an issue setting the
values of Settings fields wouldn't work because the variables used a
'protected' modifier, but I can change the value and see the results of
modifying the value between 'Settings.MoveMouseDelay = 1;' and
'Settings.MoveMouseDelay = 0;' so that leads me to believe that I can
change the value of Settings fields.  Is the 'Settings.WaitScanRate'
indeed a protected variable and one that I cannot change?

4) I can't imagine it taking ~300ms to match a 10x15 pixel image in a
12x17 pixel search region.  That 300ms isn't the amount of time it takes
to actually search for a match in the region is it?

I spent hours and hours and hours reading forum posts and experimenting
with different code combinations but I can't get rid of the ~300ms delay
when an image is NOT found.

Thanks in advance for any wise words of wisdom!

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #270582]: Problems setting Setting.WaitScanRate in Sikuli 1.0.1

2015-08-20 Thread joseytw
Question #270582 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/270582

Description changed to:
Hello,

I have searched the forums and while I have read posts that seem to
apply to the problem I am having, I can not nail down a workable
solution.  I am using Sikuli 1.0.1, and I am coding in Java on a Windows
7 machine.  I am also fairly new to coding in Java and using Sikuli.

My problem is this:

I have an array of 10 small images (10x15 pixles in size) that I iterate
through looking for a match using r.exists (the region is 12x17 pixels)
and when a match NOT found there seems to be a delay of ~300 ms before
the next check is made.

Here is the code:

int i =0;
for(Pattern p : pNumberArray){
if(r.exists(p.similar(.9f), 0) != null){
System.out.println(library.getTime() +  Image Found:  + p);
return i;
}
System.out.println(library.getTime() +  Image not found:  + p);
i++;
}

Here is the result when I run the above code.

12:19:01:032 Image not found 
12:19:01:365 Image not found 
12:19:01:698 Image not found
12:19:02:031 Image not found
12:19:02:364 Image not found 
12:19:02:697 Image not found

I was hoping using a 0 for (r.exists(p/similar(.9f), 0) would fix the
300ms delay problem but it does not.

I then read up on 'Settings.AutoWaitTimeout'
(https://answers.launchpad.net/sikuli/+question/251337) but ruled it out
as not applicable in my case.  As I understand it, using the 0 in
(r.exists(p/similar(.9f), 0) forces a one time check of the image and
immediately returns the match if found or NULL if not
(https://answers.launchpad.net/sikuli/+question/251337), so there should
be NO delay in a response whether an image is found or not.

Searching forum posts turned me on to 'Settings.ScanRate'
(https://answers.launchpad.net/sikuli/+question/194144) so I tried
setting 'Settings.WaitScanRate = 100;' so that it would search for a
match for no more than .01 seconds and return the result, but changing
that setting had no effect.  I also tried a variety of values including,
500, 1, .1f, and .01f but the results when running the code above was
always the same with ~300 ms delay.

So all that being said, that leads to my questions:
1) I assumed that setting the timeout to 0 when using exists on a region 
(r.exists(p/similar(.9f), 0) would result in NO delay in a response whether an 
image is found or not.  That is not the case.  Why is there a ~300 when the 
timeout is set to 0?

2) I assumed that setting 'Settings.WaitScanRate = 100;' would force a
search result at the end of .01 seconds.  It does not.  Am I missing
something about how this works?

3) One post I read mentioned that there used to be an issue setting the
values of Settings fields wouldn't work because the variables used a
'protected' modifier, but I can change the value and see the results of
modifying the value between 'Settings.MoveMouseDelay = 1;' and
'Settings.MoveMouseDelay = 0;' so that leads me to believe that I can
change the value of Settings fields.  Is the 'Settings.WaitScanRate'
indeed a protected variable and one that I cannot change?

I spent hours and hours and hours reading forum posts and experimenting
with different code combinations but I can't get rid of the ~300ms delay
when an image is NOT found.

Thanks in advance for any wise words of wisdom!

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #270582]: What can I do to prevent a ~300ms delay when an image is NOT found? (Sikuli 1.0.1, Java, Windows)

2015-08-20 Thread joseytw
Question #270582 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/270582

joseytw gave more information on the question:
Ahhh geez, I just looked in the bug section.  I didn't think to check
there because I assumed it was working correctly.  It looks like this
was bugged in 1.0.1 and slated for fix in 1.1.0:

https://bugs.launchpad.net/sikuli/+bug/1241993

So I am guessing that is the problem right there... and after all of
these hours banging my forehead onto my desk if I had just checked one
last place (bugs) I would have had my answer.

 Le sigh.  :)

Just so I am clear, using a 0 for (r.exists(p/similar(.9f), 0) in
combination with 'Settings.WaitScanRate = 100;' (when it is working)
should make it so that a return is made in .01 seconds, correct?

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #270582]: What can I do to prevent a ~300ms delay when an image is NOT found? (Sikuli 1.0.1, Java, Windows)

2015-08-20 Thread joseytw
Question #270582 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/270582

Status: Answered = Solved

joseytw confirmed that the question is solved:
Thanks RaiMan, that solved my question.

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #235137]: Cannot match an on-screen image while using a pattern created with BufferedImage

2013-09-04 Thread joseytw
New question #235137 on Sikuli:
https://answers.launchpad.net/sikuli/+question/235137

Hello,

I am a relative newcomer to Java coding and Sikuli both so please keep that in 
mind as you try to guide me on my way!  Also, before coming here, I searched 
through existing questions on this site and many others, but have been unable 
to find something that explains a solution in a way that I understand.

Using Eclipse, I am attempting to write stand alone executable in Java that 
searches for images and clicks on them using org.sikuli.script classes but I 
cannot seem to get either an executable jar or exe version of my code to match 
images on-screen.  In Eclipse, when I create a pattern using relative path 
names the script matches the image on-screen.  For example, if I do:

Pattern imagePattern = new Pattern(src/Images/PizzleField.PNG);
or
Pattern imagePattern = new Pattern(bin/Images/PizzleField.PNG);

Then run my script within Eclipse, the script will find the above image without 
a problem.  But, if I right click my project and Export as a runnable JAR file 
then attempt to run that JAR file, the image is no longer found.  If I unzip 
the executable JAR, I can see that the Images directory with all of the images 
is there so the image are definitely being added to the JAR file.  My research 
has led to look at using something along the lines of:

this.getClass().getClassLoader().getResource(Images/PizzleField.PNG);
 
to handle resources that are stored in a JAR file.  Since it looks like I can 
create a Pattern using a BufferedImage, I have tried to use that to access and 
manipulate the images in my executable JAR file.  Here is the code I am 
currently toying with to try and get this to work in Eclipse:

public boolean test() throws Exception {

URL imageURL = 
this.getClass().getClassLoader().getResource(Images/PizzleField.PNG);
String imageString = imageURL.toString();
BufferedImage imageBuffered = ImageIO.read(imageURL);   

System.out.println(imageURL is:  + imageURL);
System.out.println(imageString is:  + imageString);
System.out.println(imageBuffered is:  + imageBuffered);   


Pattern imagePattern= new Pattern(imageBuffered);
//(bin/Images/PizzleField.PNG);  

Screen newScreen = new Screen();
float floatPercentage = convertIntMatchToFloatMatch(80);
System.out.println(=Searching for image:  + 
imageBuffered);//bin/Images/PizzleField.PNG);
if(newScreen.exists(imagePattern.similar(floatPercentage), 3) 
!= null){
System.out.println(+Found image:  + 
imagePattern);
}
else{
System.out.println(ERROR: Could not find an onscreen 
match for the following image   + imagePattern);
}
}

When I run that code in Eclipse, the output I get is:

imageURL is: file:/C:/eclipseprojects/ffauto/ffauto/bin/Images/PizzleField.PNG
imageString is: 
file:/C:/eclipseprojects/ffauto/ffauto/bin/Images/PizzleField.PNG
imageBuffered is: BufferedImage@7646bb9f: type = 6 ColorModel: #pixelBits = 32 
numComponents = 4 color space = java.awt.color.ICC_ColorSpace@1dc80063 
transparency = 3 has alpha = true isAlphaPre = false ByteInterleavedRaster: 
width = 326 height = 22 #numDataElements 4 dataOff[0] = 3
=Searching for image: BufferedImage@7646bb9f: type = 6 ColorModel: 
#pixelBits = 32 numComponents = 4 color space = 
java.awt.color.ICC_ColorSpace@1dc80063 transparency = 3 has alpha = true 
isAlphaPre = false ByteInterleavedRaster: width = 326 height = 22 
#numDataElements 4 dataOff[0] = 3
ERROR: Could not find an onscreen match for the following image  P(-- 
BufferedImage --) S: 0.8

It looks like the imagePattern using the buffered image displays the contents 
of the image in the console log, but it never finds a match.  If I change:

Pattern imagePattern = new Pattern(imageBuffered);
to
Pattern imagePattern = new Pattern(bin/Images/PizzleField.PNG);

so that the pattern is based on a String instead of a BufferedImage, then a 
match is found on-screen.  

What am I doing wrong in the code above that is preventing my BufferedImage 
based Pattern to fail to find a match? 

My Project Heirarchy is:

FFAuto
|
|---src
||
||---(default package)
||
||---Images

Thanks in advance for any help.  If any additional details are needed please 
let me know!

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : 

Re: [Sikuli-driver] [Question #235137]: Cannot match an on-screen image while using a pattern created with BufferedImage

2013-09-04 Thread joseytw
Question #235137 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/235137

joseytw gave more information on the question:
Note: I have imported sikuli-java.jar as an external JAR and have been
using the classes found in org.sikuli.script

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #235137]: [1.0.1] Java: Pattern(BufferedImage) is not found (silently does nothing) --- usage: load images from jar

2013-09-04 Thread joseytw
Question #235137 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/235137

joseytw posted a new comment:
Thank you for your prompt reply - I really appreciate you taking the
time to read and respond to my post!  After reading your response I just
want to make sure I am clear on what it means.  When you say:

“There is no other solution available currently for images inside a jar,
so your app would only work inside eclipse with regular image file names
relative to the project folder.”

It pretty much means that if I export my code as a runnable JAR that has
images saved inside of it, that I will not be able to get Sikuli to use
the images stored in that JAR file to match an image on-screen even if I
use something like
‘this.getClass().getClassLoader().getResource(resouce)’ or try to point
Sikulu to the images inside the JAR file using relative paths.

As I understand it, my 2 options are:
1)  Keep my images outside of the JAR file and point Sikuli at those using 
either String Patterns or BufferedImage patterns
2)  Patiently wait for the BufferedImage fix to be implemented (I would be 
happy to wait by the way!)

Is this correct?

(Since I have spent so much time trying to get this to work I want to be
very clear on what my options are moving forward.  I know you are
probably busy with a million things and I would like to thank you again
for taking the time to help clarify things for me!)

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #235137]: [1.0.1] Java: Pattern(BufferedImage) is not found (silently does nothing) --- usage: load images from jar

2013-09-04 Thread joseytw
Question #235137 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/235137

joseytw posted a new comment:
What kind of crazy talk is that?

You have been kind enough to answer my questions and the least I could
do is return the favor by helping test a solution for this.  I would be
happy to help and will send an email shortly!

Thanks again RaiMan!

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

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp