Jump to content
Sign in to follow this  
Swimming_Bird

Script to wait for particular windows to open

Recommended Posts

I wanted to a script to wait for any window to open and then if that window is one of the windows i'm looking for have it perform a particular aciton.

It's easy enogh with one window, but i dont want a different script for every window that i want to deal with.

While 1
    WinWait ( 'Alert' )
    WinClose ( 'Alert' )
WEnd

Share this post


Link to post
Share on other sites

Just use a Select Case block inside a loop to handle more then 1 window of choice.

While 1
    Select
        Case WinExists('title 1')
            WinClose('title 1')
        Case WinExists('title 2')
            WinClose('title 2')
        Case WinExists('title 3')
            WinClose('title 3')
    EndSelect
    Sleep(1000)
WEnd

:)

Share this post


Link to post
Share on other sites

<3

1 quick question. will this be pretty nasty for resources? Is there any way to trigger it to just do the select when a new window appears?

Edited by Swimming_Bird

Share this post


Link to post
Share on other sites

You are going to need code to check if a new window does appear which will eat resources anyway, so you will not evade the checking. A Sleep of 1 second should not be a problem. If you have a lot of windows then perhaps using the Regular expression option 4 in a Win* function may provide more effective saving of resources and proceed with the Select statement only if the condition is true.

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  

×
×
  • Create New...