RogFleming Posted June 16, 2011 Share Posted June 16, 2011 (edited) I trying to code a Function which will look for multiple windows quickly without having to wait for a series of If statesments and such. Here was my thoughts and seems to just sit there and do nothing: #Include <WinAPI.au3> Opt("WinTitleMatchMode", 1) Global $hWnd If $hWnd=WinWait("window1" Or "Window2 Or "Window3") Then $WinTitle = _WinAPI_GetWindowText($hWnd) If StringInStr("Window1",$Wintitle) then Msgbox(1,"Found Window",$WinTitle&" "&"Was found!") Exit ElseIf StringInStr("Window2",$Wintitle) then Msgbox(1,"Found Window",$WinTitle&" "&"Was found!") Exit ElseIf StringInStr("Window3",$Wintitle) then Msgbox(1,"Found Window",$WinTitle&" "&"Was found!") Exit EndIf Else Msgbox(1,"Window Detection error","No defined window was found.") Exit Endif Edited June 16, 2011 by RogFleming Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 16, 2011 Share Posted June 16, 2011 Try the first 'If' this way, If $hWnd=WinWait("window1", "", 1) Or $hWnd=WinWait("Window2", "", 1) Or $hWnd=WinWait("Window3", "", 1) Then. I haven't tested this, so I don't know if it works..and if a window exists, it won't check past that. So if 1 is true, it won't check 2 and 3.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. 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