Wait for a window to become active

Discuss RoboTask here
Post Reply
vikassethi
Posts: 12
Joined: Tue May 08, 2007 9:28 am
Location: India
Contact:

Wait for a window to become active

Post 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?
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Wait for a window to become active

Post 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
vikassethi
Posts: 12
Joined: Tue May 08, 2007 9:28 am
Location: India
Contact:

Wait for a window to become active

Post by vikassethi »

Thanks. That was helpful.
Post Reply