Sign in to follow this  
Followers 0
___Kevin___

Wait For Multiple Windows With Only Partially Known Title

4 posts in this topic

Hi,

i'm trying to write a script that waits for windows to come up and handles them.

At the moment, this is my code:

Opt("WinTitleMatchMode", 2)
;wait for a window containing "Untitled"
WinWaitActive("Untitled")
$title = WinGetTitle("Untitled")
... do something...

This only works with one window. I need to handle multiple windows which contain my searchstring in their titles, so something returning a list of titles matching my search would be perfect. Any ideas?

Thanks,

Kevin.

Share this post


Link to post
Share on other sites



WinList()

'Nuff said

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Oops... Thanks.

Edited by ___Kevin___

Share this post


Link to post
Share on other sites

This is the nicest solution to this if you ask me. Have not tried it yet thought.

The Latest AutoIt Beta can wait for more then 2 windows by using regular expressions.

Here is a Demo

Opt('WinTitleMatchMode', 4)
Switch Random(1, 3, 1)
    Case 1
        RunWait('explorer "' & @ProgramFilesDir & '"')
    Case 2
        RunWait('explorer "' & @WindowsDir & '"')
    Case 3
        RunWait('explorer "' & @SystemDir & '"')
EndSwitch
WinWait('regexp=(?i)program files|windows|system32', '', 1)
$title = WinGetTitle('regexp=(?i)program files|windows|system32')
Sleep(500)
WinClose($title)

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