Imaging.FindOptions ()

Ranorex Spy, Recorder, and Studio.
wyll
Posts: 34
Joined: Wed Aug 01, 2012 3:19 pm

Imaging.FindOptions ()

Post by wyll » Tue May 14, 2013 3:28 pm

Hi,

I have a question regarding the timeout of Images...
how can i set them?

i have
Imaging.FindOptions fOpt = new Imaging.FindOptions();
fOpt.Timeout = 100;

Imaging.Contains(Element, Bitmap, fOpt)....
]

so with this my Bitmap should be found in 100ms.
It starts with 100ms, but when i decided to change that value, because it is too short, lets say 5000ms it still searches with the same timeout of 100ms... i dont have the feeling it searches for 5 seconds, actually i know it doesn't

Is there something wrong? Or might that be a bug?

regards wyll

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Imaging.FindOptions ()

Post by Support Team » Wed May 15, 2013 2:38 pm

Hello,

Your setting for timeout should work correctly.
Which Ranorex version do you use?

Could you please measure the period of time for the Imaging.Contains action?
You could use System.DateTime.Now to measure the elapsed time.

Thank you in advance.

Regards,
Markus (T)
.
Image

wyll
Posts: 34
Joined: Wed Aug 01, 2012 3:19 pm

Re: Imaging.FindOptions ()

Post by wyll » Wed May 15, 2013 4:06 pm

Ranorex 4.0.3
I am using a stopwatch, i think it should have the same effect
for(i=0;i<5;++i)
{
  stopwatch.start();
  Imaging.Contains(myElement,myBmp,myOptions);
  stopwatch.stop();
  Report.Info(stopwatch.ElapsedMilliseconds.ToString());
  stopwatch.reset();
}
so this function should shoot out 5 values,
they show up values around 1000. So i do not really remember the first time i have set it up the first time, but changing my timeout now to 100... still the same values of 1000
timeout to 500... still the same values

regards

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Imaging.FindOptions ()

Post by Support Team » Wed May 15, 2013 4:34 pm

The FindOptions.Timeout property will not cause a search iteration to be aborted. It just tells Ranorex to start a new search iteration on an updated element screenshot as long as the timeout is not reached.
wyll wrote:timeout to 500... still the same values
Seems like a single search iteration takes about 1000ms. Try changing the timeout to 5000ms and see the result.

Additionally, the FindOptions.Timeout property only applies to image searches done on elements, not on bitmaps directly (it does not make sense to search a bitmap anew, only an updated screenshot from an element). So the first method argument always needs to be an element or adapter if you want the timeout to be used.

Regards,
Alex
Ranorex Team
.
Image