Page 1 of 1

Wait for a window to become active

Posted: Wed May 16, 2007 7:05 am
by vikassethi
I am creating a task where I need to open a process through command line parameter and then I need to wait for the window of that process to become active before I can send some keystrokes to that process.
I have successfully opened the process through Robotask but the "Wait untill the application is ready for input" option is not working. 
so I now want to use a loop which will check for the existence of the window where I need to input some data. How do I loop and wait for a particular window to become active?

Wait for a window to become active

Posted: Sat May 19, 2007 11:51 pm
by Oleg
You can use the simple loop for waiting the window.
Suppose we wait necessary window 10 sec
See the following algorithm:

Simple loop from 1 to 20
   If {IsWindowActive(Window Caption)} then
      break
   else
      pause 500
   end
end loop

Thus we wait 0,5 sec if our window is not active, and break the loop if window is active.
Maximum waiting time - 10 sec

Wait for a window to become active

Posted: Tue May 22, 2007 7:34 pm
by vikassethi
Thanks. That was helpful.