Jump to content

Recommended Posts

Posted

I have a script that I have used for years which starts one of our applications under test, waits for the application window to be active, and then drives the application's UI.

I used to be able to use:

WinWaitActive ("Application title bar")

quite reliably.

But then, frequently, but not always, the window didn't become active by itself so the wait never ended.  If I clicked on the app title bar, it would becomeactive and the script would proceed.

So I modified the script to the following:

$DBThwnd = WinWait ("Application title bar")
WinActivate ($DBThwnd)
WinWaitActive($DBThwnd)

This doesn't work any better, however, the application icon on the taskbar becomes highlighted, but the window itself stays not active.

This is on Windows 10, 64 bit, Version 1909 and the latest released version of AutoIt.

Curiously, when the app icon is highlighted on the taskbar, if I double click to open another application on the desktop, and then close it, then my application window becomes active and the script continues.

Clearly, there's something about window activation that I don't understand, but my defense is that it used to work!

 

Posted (edited)

I added the following:

WinSetState("", "", @SW_MINIMIZE)

just before what I was using (which was failing):

$DBThwnd = WinWait ("Application title bar")
WinActivate ($DBThwnd)
WinWaitActive($DBThwnd)

and the script reliably continues with the activated window.

I'm not at all sure what that WinSetState is doing.

Edited by 1234567890
new information

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
  • Recently Browsing   0 members

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