DanDaniels Posted March 30, 2005 Share Posted March 30, 2005 I have an application where, after a Send() call, one of two known windows will appear. Question: What is the most efficient method of waiting on more than one window simultaneously then branching to the appropriate code. Thanks in advance! Link to comment Share on other sites More sharing options...
Developers Jos Posted March 30, 2005 Developers Share Posted March 30, 2005 I have an application where, after a Send() call, one of two known windows will appear.Question: What is the most efficient method of waiting on more than one window simultaneously then branching to the appropriate code.Thanks in advance!<{POST_SNAPBACK}>one way is:While 1 if WinExists("title","text1") then ; do whats needed on text1 ExitLoop ElseIf WinExists("title","text2") then ; do whats needed on text2 ExitLoop EndIf sleep(10) WEnd SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DanDaniels Posted March 30, 2005 Author Share Posted March 30, 2005 That's a nice solution, thanks. I was hoping there would be something that didn't require polling, but your solution is certainly acceptable. Link to comment Share on other sites More sharing options...
Ejoc Posted March 31, 2005 Share Posted March 31, 2005 Basicly the same thing: GUICreate("Random",100,100) If Random(0,1,1) Then GuiCtrlCreateLabel("Success",0,0) Else GUICtrlCreateLabel("Error",0,0) EndIf GUISetState(@SW_SHOW) If WinWaitEither("Random","Error","Random","Success") = 1 Then MsgBox(0,"","Error Opened") Else MsgBox(0,"","Success Opened") Endif Exit Func WinWaitEither($title1,$text1,$title2,$text2) While 1 If WinExists($title1,$text1) Then Return 1 If WinExists($title2,$text2) Then Return 2 Sleep(100) WEnd EndFunc Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
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