Jump to content

WinActivate not happening immediately?


Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...