Jump to content

Conditional Window Matching


Recommended Posts

An AutoIt script is used to handle an installer. At a certain point during the installation process two different windows may pop up. From your experience or mere immeasurable wisdom; what is the best way to code?

1. Use two WinWaitActive statements with timeouts within any kind of loop. Decide by the return value which programm branch to handle.

2. Use WinList and pick the right window. Again, use a loop with a timeout to allow the window to pop up.

3. Use WinWaitActive with a RegExp. Upon a match, check the window title with an If Then Else.

4. Something completly different.

Link to comment
Share on other sites

Try this:

While 1
Select
    Case WinActive( "Title of window 1" )
        ;Do something
        ExitLoop ;Stop checking for an active window
    Case WinActive( "Title of window 2" )
        ;Do something else
        ExitLoop ;Stop checking for an active window
    Case Else
        ;If neither is active yet, do this
EndSelect
Sleep(200) ; So that the CPU doesn't get hogged
WEnd
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...