JCWohlschlag Posted January 12, 2022 Posted January 12, 2022 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.
Luke94 Posted January 12, 2022 Posted January 12, 2022 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?
ad777 Posted January 12, 2022 Posted January 12, 2022 (edited) 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 January 12, 2022 by ad777 none
JCWohlschlag Posted January 12, 2022 Author Posted January 12, 2022 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.
ad777 Posted January 12, 2022 Posted January 12, 2022 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) none
ad777 Posted January 12, 2022 Posted January 12, 2022 try this if didn't work: For $i =0 To 1 Step 1 ControlCommand("[CLASS:#32770]", "", "Button2", "check", "") Next none
Danp2 Posted January 12, 2022 Posted January 12, 2022 Could be an rights issue. Have you tried adding #RequireAdmin at the beginning of your script? Latest Webdriver UDF Release Webdriver Wiki FAQs
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now