Swimming_Bird Posted January 14, 2007 Posted January 14, 2007 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
MHz Posted January 14, 2007 Posted January 14, 2007 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
Swimming_Bird Posted January 14, 2007 Author Posted January 14, 2007 (edited) <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 January 14, 2007 by Swimming_Bird
jvanegmond Posted January 14, 2007 Posted January 14, 2007 That way it will require you to constantly check all existing windows against all previous windows, which is more resource intensive. Keeping it simple is generally the best way to keep it resource friendly. github.com/jvanegmond
MHz Posted January 14, 2007 Posted January 14, 2007 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now