User code & progress display

Best practices, code snippets for common functionality, examples, and guidelines.
HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

User code & progress display

Post by HansSchl » Thu Jul 30, 2020 8:29 am

Built-in actions display some text in a window that pops up in the lower right corner of Ranorex Studo during execution (I don't know what this window is called technically). Some actions, like "Delay", even display a count-down watch. Can user code do that, too? If so, how?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: User code & progress display

Post by odklizec » Mon Aug 03, 2020 7:53 am

Hi,

I believe you can write to progress form using Report method? Just add Report.Info or Report.Debug (with incorporate parameters) anywhere in your solution and check if it writes to progress dialog ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Re: User code & progress display

Post by HansSchl » Mon Aug 03, 2020 1:01 pm

I'm sorry I was not precise enough when I posted my question. I wanted to know whether it is possible to display the count down. I found that calling Delay.Milliseconds etc. displays the count down, but what about user code that needs to do repeated checks for one out of several conditions? The code would check a timeout in every iteration, like this:

Code: Select all

var startTime = System.DateTime.Now;
do
{
  // check conditions
}
while (System.DateTime.Now - startTime <= timeout);
I'd like to display the count down while the loop is executed.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: User code & progress display

Post by odklizec » Mon Aug 03, 2020 1:30 pm

Hi,

As I mentioned in my post, I believe that the only way how to update text in progress form, is by using Report method. So I guess you must simply add Report method inside the loop...

Code: Select all

var startTime = System.DateTime.Now;
do
{
  // check conditions
  Report.Debug(....);
}
while (System.DateTime.Now - startTime <= timeout);
So if you want to display the countdown, you must do it inside the loop.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Re: User code & progress display

Post by HansSchl » Mon Aug 03, 2020 6:11 pm

Ok, so there is no elegant solution... thanks for pointing that out, it saves me from searching on and on! Btw yes, Report lets me output to the pop-up window. I haven't yet tried to output repeatedly.

Hans