wfuehrer Posted January 5, 2005 Share Posted January 5, 2005 Hi! I run some actions in a window and want to end this by klicking on [Cancel] in the message box or when the user closed the main window. ;.... ;here window is open $counter = 1 Do WinActivate("Advertised Programs Monitor") MsgBox(0,"Refresh","Refresh " & $counter, 1) send("!V") sleep(500) send("r") $counter = $counter + 1 $answer = MsgBox(1,"Softwarerefresh", $counter & ". Refresh in 60 sec." & @crlf _ & "until [Cancel] is pressed", 58) if Not WinExists("Advertised Programs Monitor") then ExitLoop Until $answer = 2 WinKill("Advertised Programs Monitor") MsgBox(0,"Refresh End", "Refresh End",5) When i close the main window "Advertised Programs Monitor" the script still runs. Any ideas? Wolfgang Führer Link to comment Share on other sites More sharing options...
Blue_Drache Posted January 5, 2005 Share Posted January 5, 2005 (edited) Hi!I run some actions in a window and want to end this by klicking on [Cancel] in the message box or when the user closed the main window.CODE;....;here window is open$counter = 1DoWinActivate("Advertised Programs Monitor") MsgBox(0,"Refresh","Refresh " & $counter, 1)send("!V")sleep(500)send("r")$counter = $counter + 1$answer = MsgBox(1,"Softwarerefresh", $counter & ". Refresh in 60 sec." & @crlf _ & "until [Cancel] is pressed", 58)if Not WinExists("Advertised Programs Monitor") then ExitLoopUntil $answer = 2WinKill("Advertised Programs Monitor")MsgBox(0,"Refresh End", "Refresh End",5)When i close the main window "Advertised Programs Monitor" the script still runs.Any ideas?<{POST_SNAPBACK}>Ok, how about changingif Not WinExists("Advertised Programs Monitor") then ExitLoopintoif WinExists("Advertised Programs Monitor") = 0 then ExitLoopI know it sounds like they say the same thing, but I've had problems with the "Not" function in my code and when I change it around, it works properly. Go figure. Edited January 5, 2005 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Chris_1013 Posted January 5, 2005 Share Posted January 5, 2005 Hmmm, I've just tested the script, and the logic seems sound. When you say the script still runs, do you mean you still see the message boxes popping up? Link to comment Share on other sites More sharing options...
MHz Posted January 5, 2005 Share Posted January 5, 2005 You still have 2 Message boxes stopping the loop. Maybe AdlibEnable to monitor the window?AdlibEnable('final', 5) Func final() If Not WinExists("Advertised Programs Monitor") Then Exit EndFunc Not WinExists works for me? Must be lucky. Link to comment Share on other sites More sharing options...
Chris_1013 Posted January 5, 2005 Share Posted January 5, 2005 (edited) Not WinExist always works for me too. I don't see why the message boxes would be an issue, they have a timeout value... The first is only 1 second, so it goes quite quick, and the second will be closed because the cancel is clicked. Edited January 5, 2005 by Chris_1013 Link to comment Share on other sites More sharing options...
wfuehrer Posted January 5, 2005 Author Share Posted January 5, 2005 (edited) Hmmm, I've just tested the script, and the logic seems sound. When you say the script still runs, do you mean you still see the message boxes popping up?Yes - the message boxes appears every 60 seconds again.Changing the code in if WinExists("Advertised Programs Monitor") = 0 then ExitLoopbrings up the same results.The send in loop is working in the next active window Edited January 5, 2005 by wfuehrer Wolfgang Führer Link to comment Share on other sites More sharing options...
wfuehrer Posted January 5, 2005 Author Share Posted January 5, 2005 Hi! I found a solution. if not WinExists("Advertised Programs Monitor","program(s)") then ExitLoop The other versions are working, too. It is nessecary to add a text part. Wolfgang Führer 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