Sign in to follow this  
Followers 0
Gameday

WinActivate not happening immediately?

3 posts in this topic

I had a problem yesterday with some of the commands sent to a cmd.exe turning up differently ( ). It turned out to be kind of a race condition. I was doing a WinActivate and then immediately going for the send. Somehow, when I sent something like dir && ls to cmd.exe, it got there as dir 77 ls. I added a Sleep after the WinActivate and the Send, and everything turned out ok.

How long does it usualy take for WinActivate, to activate? :unsure:

Is it posting a message, and everything happens later? Is there another function I could call, that would happen immediately? I'd like to make sure that my window is really active when I'm trying to send.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I had a problem yesterday with some of the commands sent to a cmd.exe turning up differently ( ). It turned out to be kind of a race condition. I was doing a WinActivate and then immediately going for the send. Somehow, when I sent something like dir && ls to cmd.exe, it got there as dir 77 ls. I added a Sleep after the WinActivate and the Send, and everything turned out ok.

How long does it usualy take for WinActivate, to activate? :unsure:

Is it posting a message, and everything happens later? Is there another function I could call, that would happen immediately? I'd like to make sure that my window is really active when I'm trying to send.

Look at WinWaitActive in the help file.

Edited by Warmonger

Share this post


Link to post
Share on other sites

Hi WarMonger!

I know of the WinWaitActive, but the following combination didn't seem to work yesterday:

WinActivate("My Window")
WinWaitActive("My Window")

After I called WinWaitActive, the only way my code continued was if I made it active by clicking on it. My AutoIt script is running on a remote computer, automating part of a build process , and I will not be able to activate it manually.

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  
Followers 0