How to tell if Pause/Abort has been pressed?
Posted: Mon Mar 12, 2012 6:31 pm
Lets say I have some code that keeps clicking a button all day, until 2:00 pm, when the button disappears and Ranorex can stop:
This works fine for me, except for one case. When the user clicks the Pause key, an exception is thrown in the try block and when it is not 2 pm, and Ranorex tries to re-open the screen with the button before stopping.
The only way I can think around this is to check if the Pause key was clicked in the catch, but how can I do this? Is it possible to programmatically determine if the Pause key was pressed within Ranorex?
Code: Select all
try
{
keepRunning:
// while window visible, keep doing the following
while (repo.FormAdd_Markets_to_Market_Da.ButtonDone.Visible)
{
repo.FormICE_Formula_Trader_Light.Container_userDataArea.EnsureVisible();
repo.FormICE_Formula_Trader_Light.Container_userDataArea.Click();
}
}
catch // window gone or Pause key has been pressed
{
if ("2:00 pm")
{
// do some things and then let program close
}
else
{
// re-open window with button and keep clicking
// ... code removed
goto keepRunning;
}
}
The only way I can think around this is to check if the Pause key was clicked in the catch, but how can I do this? Is it possible to programmatically determine if the Pause key was pressed within Ranorex?