Jump to content
Sign in to follow this  

WinWaitActive doesnt work as expected

Recommended Posts


Hi all

I have a C# application with windows forms, using which I need to automate the opening of a file using an in-house software( mySoftware). I have the following code as below. My understanding is that WinWaitActive() should wait until I click on the in-house software window (mySoftwareWindow) and make it active, before the code moves on to the next line and opens the specified xml file (line 6 in code below). Instead whats happening is that the next line of code runs even before I can make the in-house software active, thus running the Open button (line 6 in code below) on the current active window, which in this case is the C# application form. What do you think is going wrong here? Thanks!

aut = new AutoItX3Lib.AutoItX3Class();

aut.WinWaitActive("mySoftwareWindow", "", 1);

aut.WinMenuSelectItem("mySoftwareWindow", "", "&File", "&Open", "", "", "", "", "", "");

aut.Send("C:\\test.xml", 0);

//click the Open button

aut.Send("!o", 0);

aut.Send("{ENTER}", 0);

Share this post

Link to post
Share on other sites


You are setting 1 for the timeout parameter of WinWaitActive so it waits 1 second for the set title with the set text and if it appears earlier then 1 second, it continues, else once 1 second timeout expires, then it again continues. Set it to 0 for no timeout.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.