How to Click on a Button which has an ID Button3 when it is inactive and it changes to Button1 when it is active , using Autoit -


i using autoit automate our qa installer. new this. stuck @ point. scenario explained below.

i run .exe file using run command, takes time background checking , starts install application. during process next button disabled class @ point in time button3 , when next button enabled class changed button1. not sure how code part. have used below codes failed.

winwait("airwatch - installation wizard","") if not winactive("airwatch - installation wizard","") 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', '') sleep(10) until controlcommand('airwatch - installation wizard', '', 'button1', 'isenabled', '') endif

i ran same problem , ended doing simulated click on windows bar. should refresh window , should have original controlid button. seems hacky, whole autoit-language pretty hacky anyway.

the code doing click looks this:

winactivate($winname, "") winwaitactive($winname, "") $winpos = wingetpos($winname, "") ;  $winpos-array contains x/y-coords. click @ mainbar windows ;  , instant (invoked last parameter being 0) mouseclick("primary", $winpos[0] + 150, $winpos[1] + 10, 1, 0) ; ....  ; ... stuff