Jump to content

Cannot Get ControlClick to Click Button


Recommended Posts

Hello, everyone. I am pretty new to AutoItScript, having only used it a few times in the last decade. I am trying to automate the install of Draytek Smart VPN Client software (due to it not having any unattented/automated installation controls of its own). I cannot figure out why my script is not able to click the “Next” button in this installation window.

 

SetError(100)
WinWait("Smart VPN Client 5.5.1 Setup", "Welcome to Smart VPN Client 5.5.1 Setup")
MsgBox(4096, "AutoIt Status", "Draytek window: " & @error, 10)

SetError(100)
ControlClick("Smart VPN Client 5.5.1 Setup", "&Next >", '[CLASS:Button; INSTANCE:2)')
MsgBox(4096, "AutoIt Status", "Next button: " & @error, 10)

 

Both the  WinWait and ControlClick functions are resetting @error back to 0, so they are not setting their own error codes of any sort. The Draytek Smart VPN Client installation window just sits there, however, without advancing to the next dialog.

Draytek.png.36ae3b104c765e527989546951687d56.png

AutoItWindow.png.1777ab8f8d683a800b45dbbbf09244d8.png

Link to comment
Share on other sites

the problem was --> ) 

replace it with --> ]

ControlClick("Smart VPN Client 5.5.1 Setup", "&Next >", '[CLASS:Button; INSTANCE:2]')

 

if didn't work use class insted:


ControlClick("[CLASS:#32770]", "&Next >", '[CLASS:Button; INSTANCE:2]')

Edited by ad777

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

Link to comment
Share on other sites

22 minutes ago, Luke94 said:
Local $hWnd = WinWait('Smart VPN Client 5.5.1 Setup', '', 5)
If IsHWnd($hWnd) = 1 Then
    If WinActive($hWnd) = 0 Then WinActivate($hWnd)
    ControlClick($hWnd, '', '[CLASS:Button; INSTANCE:2]')
EndIf

Does this work?

It brings the Draytek install window to the front, but does not click the button and advance the dialog.

 

23 minutes ago, ad777 said:

the problem was --> ) 

replace it with --> ]

ControlClick("Smart VPN Client 5.5.1 Setup", "&Next >", '[CLASS:Button; INSTANCE:2]')

 

if didn't work use class insted:


ControlClick("[CLASS:#32770]", "&Next >", '[CLASS:Button; INSTANCE:2]')

Thank you for catching my typo. Neither fixing that typo nor your other suggestion of using the explicit [CLASS:#32770] argument worked. Installation window sits on that first dialog and the button does not click.

Link to comment
Share on other sites

you forget to add WinActivate("[CLASS:#32770]") in first line the window shoud be active:

your code shoud be:

WinActivate("[CLASS:#32770]")
Sleep(1000)
SetError(100)
WinWait("Smart VPN Client 5.5.1 Setup", "Welcome to Smart VPN Client 5.5.1 Setup")
MsgBox(4096, "AutoIt Status", "Draytek window: " & @error, 10)

SetError(100)
ControlClick("[CLASS:#32770]", "&Next >", '[CLASS:Button; INSTANCE:2]')
MsgBox(4096, "AutoIt Status", "Next button: " & @error, 10)

 

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...