3

I am using AutoIt to automate an installer, which I start using Run().

Initially the installer's Next button is disabled (whose class at this point in time is Button3). When the Next button is enabled its class changes to Button1. I am not sure how to target this button:

WinWait("AirWatch - Installation Wizard", "")
If Not WinActive("AirWatch - Installation Wizard", "") Then WinActivate("AirWatch - Installation Wizard", "")
WinWaitActive("AirWatch - Installation Wizard", "")
While Not ControlCommand('AirWatch - Installation Wizard', '', 'Button3', 'IsEnabled', '')
    Sleep(500)
WEnd
ControlClick('AirWatch - Installation Wizard', '&Next >', '[ID:17696]')
;Note: Text: &Next >
If Not ControlCommand('AirWatch - Installation Wizard', '', 'Button1', 'IsEnabled', '') Then
    Do
        Sleep(10)
    Until ControlCommand('AirWatch - Installation Wizard', '', 'Button1', 'IsEnabled', '')
EndIf
user4157124
  • 2,809
  • 13
  • 27
  • 42
nandish
  • 41
  • 2
  • 3
    When you say that `the class is changed` what you actually mean is that the button is hidden and the next button is shown, I don't think the class would be changing (though you can verify this by checking if the handle changes). Please could you format your code, and also add some more information such as what `[ID:17696]` is, and what the text `&Next >` applies to (currently you are using it as the window text, which I don't think is what you intended). Other information that would be useful is what is the state of `Button1` before it becomes visible. – Matt Aug 23 '13 at 14:11

1 Answers1

0

Simulate a click on the Windows start bar. This should refresh the window and then it should have the original ControlID for the button. This seems hacky.

The code :

WinActivate($WinName, "")
WinWaitActive($WinName, "")
$winPos = WinGetPos($WinName, "")
;  $winPos-Array contains x/y-coords. The click will be at the mainbar for most windows
;  and will be instant (invoked by the last parameter being 0)
MouseClick("primary", $winPos[0] + 150, $winPos[1] + 10, 1, 0)
; .... 
; ... Do your stuff
user4157124
  • 2,809
  • 13
  • 27
  • 42
Peter Wildemann
  • 465
  • 4
  • 13