flynnibus Posted September 6, 2008 Share Posted September 6, 2008 Autoit newbie here working on my first script, trying to add some error handling. Automating an Installshield application... generally the steps are fixed, so the main script work is winwaitactive(...) ControlClick(...) winwaitactive(next step) ... but at one step, the program verifies the input, and if it fails, one of two pop-up windows will open. How can I conditionally check for either of these two windows, and if they do not appear, continue with the expected next step? If I could just say 'check what window opens next', but I can't figure out how to say wait for the NEXT window, only wait for anything (which I assume will trigger on the existing window) or wait for a specific titled window. TIA Link to comment Share on other sites More sharing options...
Champak Posted September 6, 2008 Share Posted September 6, 2008 (edited) $i = 0 do sleep(500) $i += 1 until winexists(1) or winexists(2) or $i = 5 if winexists(1) then ; "whatever 1" elseif winexists(2) then ; "whatever 2" endif ;...Your next step Edited September 6, 2008 by Champak Link to comment Share on other sites More sharing options...
rasim Posted September 6, 2008 Share Posted September 6, 2008 flynnibusSee:AdlibEnable()WinExists()functions in the help. Link to comment Share on other sites More sharing options...
flynnibus Posted September 6, 2008 Author Share Posted September 6, 2008 $i = 0 do sleep(500) $i += 1 until winexists(1) or winexists(2) or $i = 5 if winexists(1) then ; "whatever 1" elseif winexists(2) then ; "whatever 2" endif ;...Your next step Thanks Champak - that's right on with what I need. I wasn't sure how the if conditions could be evaluated and cycled, and the do.. until makes perfect sense. Thx for the response. Link to comment Share on other sites More sharing options...
flynnibus Posted September 6, 2008 Author Share Posted September 6, 2008 flynnibusSee:AdlibEnable()WinExists()functions in the help.Thanks rasim - the AdlibEnable looks interesting and looks like a decent way to catch unexpected pop-ups and prevent the overall program from hanging.I was wondering what most people wrap their programs in to prevent stalling - is this a common way of doing it?Right now my main body is in a while @error= 0 ..WEnd block but its not very tight because not all functions set @error and putting error checking on every winwaitactive or control seems like overkill 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