3

I dont know how to make this working or I am missing something - maybe in #include ? at this point I have:

#RequireAdmin
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>

;vcdredist
Run($sDrivers & "\vcredist_x86.exe")
WinWaitActive("vcredist_x86")
;ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[CLASS:Button; INSTANCE:3]")
ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[ID:105]")

I've checked with AutoIt v3 WIndow Control and arguments inside ControlClick are correct

none of last two lines make AutoIt select desired option. Any help very much appreciated.

Msmkt
  • 1,261
  • 16
  • 24

4 Answers4

1
WinWaitActive()

Probably Isn't the thing you're looking for, as it waits for the window to be active for the code to be ran. WinActivate() activates the window. If you want the code to run when you activate the window, then WinWaitActive() will do.

Also you can avoid having the title in the ControlClick by doing this.

$hWnd = WinWait("vcredist_x86")
WinWaitActive("vcredist_x86")
ControlClick($hWnd, "", "[CLASS FROM AUTOITINFO]", "Left", 1)

Use the Autoit Window Info tool to find the classes if you aren't using it already. (https://www.autoitscript.com/autoit3/docs/intro/au3spy.htm)

If ControlClick still doesn't work, then you can try using

MouseClick("Left", x, y)

X, Y are the coordinates.

Milos
  • 2,927
  • 1
  • 15
  • 27
Dragg
  • 336
  • 1
  • 9
0

Probably the script is waiting to the window become active WinWaitActive().

In this case you can use a WinActivate before the WinWaitActive to avoid this problem.

If you want a more robust solution you can use this:

While Not WinActive($win)
    WinActivate($win)
    Sleep(500)
WEnd
Rofellos
  • 198
  • 3
  • 11
0

I wrote a UDF in AutoIt to wait for controls. posted around here a few times. just feed it the stuff you want and how long, if applicable you want to wait. you can wait forever by default.

However, there is an easier solution, install it in quiet mode. run a command

Run($sDrivers & '\vcredist_x86.exe /q')

now you don't have to poke any buttons. also, it's better not to use ID because if you are testing an application that is changing, the developers can change all that. I use button text as additional search criteria instead. much more reliable and less maintenance on my code.

-1

Have gone through the similar situation for one application while trying to automate that, after trying all the debugging just added the below command and it worked like charm

#RequireAdmin
Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
sai 995
  • 1
  • 3