Sign in to follow this  
Followers 0
flynnibus

how to conditionally detect which window opened

5 posts in this topic

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

Share this post


Link to post
Share on other sites

flynnibus

See:

AdlibEnable()

WinExists()

functions in the help.

Share this post


Link to post
Share on other sites

$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.

Share this post


Link to post
Share on other sites

flynnibus

See:

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0