tags:

views:

241

answers:

2

I am trying to write an AutoIt3 script to go through a wizard to setup a program. At one point, depending on what has already been installed on the machine, it may or may not pop up another dialog saying something like "This already exists.. what would you like to do?". Then I would make the script handle that dialog and then continue.

The problem is that I can't figure out how to make it branch on something if it pops up without having two separate AutoIt scripts running: one to do the main wizard setup, and one to watch for the possible popup.

Any suggestions?

A: 

If you know where in the setup the dialog pops up, you can try this: after you move through the wizard to this point, WinWait for the dialog. If WinWait returns without success, the dialog probably did not pop up.

Piskvor
Nice! Works like a charm. Having two separate scripts running actually seems to be more reliable in certain situations, but is definitely *not* the way I'd like to have to do things. So thanks :)
Markus Orreilly
+1  A: 

If you don't know when it will happen (something that could pop up at any time) you could try this...

AdlibEnable("myadlib")

Func myadlib()
    If WinActive("Error") Then
        ;...
    EndIf
EndFunc

From the help file...

AdlibEnable

Enables Adlib functionality.

AdlibEnable ( "function" [, time] )

Parameters

function The name of the adlib function to call. time [optional] how often in milliseconds to call the function. Default is 250 ms.

Copas