Jump to content
nowiminit

Unable to Click Button During 'Silent Uninstall'

Recommended Posts

I am having difficulty with a silent uninstall for an older version of Dell Sonicwall.

I have a command that should run a silent install: msiexec.exe /X{0E14625B-DF56-4657-8678-DFD1955BE97A} /qn /norestart

However, it is not completely silent and there is a dialogue box that pops up. All I need to do is simply click ‘continue’ and this is where my problem lies.

 

With AutoIt, or AHK and other macro recorders, I’m unable to click the continue button or alternatively press enter and finish the uninstall. If I am just playing around I can see my mouse click at the given point on screen, but it cannot seem to focus or click on that dialogue window.

 

Here’s the button summary from AutoIt Info:

 

 

>>>> Window <<<<

Title:      Global VPN Client

Class:     #32770

Position:              430, 215

Size:       506, 297

Style:     0x94C800CC

ExStyle: 0x00010101

Handle: 0x0000000000170654

>>>> Control <<<<

Class:     Button

Instance:             3

ClassnameNN:  Button3

Name: 

Advanced (Class):            [CLASS:Button; INSTANCE:3]

ID:          1

Text:      Continue

Position:              404, 234

Size:       87, 24

ControlClick Coords:       23, 12

Style:     0x50010000

ExStyle: 0x00000004

Handle: 0x00000000001B07D8

>>>> Mouse <<<<

Position:              430, 272

Cursor ID:            0

Color:    0xC1E1E1

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

Uninstall Global VPN Client

The uninstallation of Global VPN Client is almost complete. The following actions can be performed as part of the uninstallation process.

Click Continue to complete the uninstallation.

&Delete all settings and configuration files

&Retain the MAC address of the virtual adapter

Continue

>>>> Hidden Text <<<<

 

 

Here is my code:

 

#RequireAdmin

run("msiexec.exe /X{0E14625B-DF56-4657-8678-DFD1955BE97A} /qb /norestart")

AutoItSetOption('MouseCoordMode', 0)

WinWait('Global VPN Client', 'Click Continue')

WinActivate('Global VPN Client')

Send("{TAB}{TAB}{ENTER}")

Sleep(300)

;MouseClick('primary', 447, 272, 1, 0)    //Doesn't work

;ControlClick('Global VPN Client', 'Click Continue', 1)    //Doesn't work

 

 

I am running this script using #requireadmin, any suggestions or advice is appreciated.

Sonicwall_writeup.PNG

Share this post


Link to post
Share on other sites
Posted (edited)

Control click didn’t work because you’re not using it correctly go through all the parameters and set them. the name of the button is continue, not whatever you listed in that function

 

Also you have to make sure to wait for that control to actually exist

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

Please use this tool when you post code.

Try always using handles instead of string to access windows and controls.  Here an example based on your script :

#RequireAdmin
#include <Constants.au3>

run("msiexec.exe /X{0E14625B-DF56-4657-8678-DFD1955BE97A} /qb /norestart")

Local $hWnd = WinWait('Global VPN Client')
If Not $hWnd Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error on title")
WinActivate($hWnd)
Local $hCtrl = ControlGetHandle($hWnd, "", "Button3")
If Not $hCtrl Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error on control")
ControlClick($hWnd, "", $hCtrl)

 

Share this post


Link to post
Share on other sites

@Earthshine

Thanks for your reply... I've tried a bunch of variations on control click but I've never had any luck. Here's a few more examples:

ControlClick('Global VPN Client', '', "Button3")

ControlClick('Global VPN Client', '', "Continue")  

ControlClick('Global VPN Client', '', 1) 

Share this post


Link to post
Share on other sites

@Nine

Thanks for giving me that example, it's far cleaner and I'll try to work off of that in any future AutoIt scripts. Sadly, I'm still struggling on the same issue with your provided script. There are no msgboxes that popup with your error message, but also the button still remains unclicked. Any further ideas on what I can try?

Share this post


Link to post
Share on other sites

put a longer sleep before trying to click the button. if that works then it means you just need to wait longer for the button to exist. I have a small script that waits for controls automatically for using on installers


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

I see that the handle showed in the info tool is 64 bit.  Try using x64 to run your script instead of x86...

Share this post


Link to post
Share on other sites
Posted (edited)

and try controlclick like this if you don't want to get handles, but getting the handle is something my udf does for you based on the dialog and buttons on the form. this ensures that you are speaking to the correct instance of your control.

 

ControlClick("[CLASS:#32770]", "Global VPN Client", "[CLASS:Button; INSTANCE:3]", "Continue")

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

@Earthshine  4th parameter of ControlClick

Quote
button [optional] The button to click, "left", "right", "middle", "main", "menu", "primary", "secondary". Default is the left button.

Not "Continue"...

Share this post


Link to post
Share on other sites

oh yes! sorry. I just use my WaitForControls UDF to wrap that function and find my controls when they are actually ready. So I rarely ever use ControlClick directly.


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

@Earthshine

No luck with your your revised ControlClick, the wait I have here seems to trigger correctly and at the right time:

WinWait("Global VPN Client", "Click Continue")

 But the click just never seems to do anything.

 

@Nine

I've tried compiling and running the script in both x64 and x86 and no luck either.

 

Thanks both you two for helping me out with this issue and sticking with me. I really appreciate the efforts, but that button is one stubborn button that doesn't want to be pressed lol.

Share this post


Link to post
Share on other sites

Can you give me a link so I can install that version in a virtual machine and test it? I will need that version of sonic wall


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

Can you verify that the script AND the info tool share the same handles (both window and control) ?

Share this post


Link to post
Share on other sites

Add ConsoleWrite in the script for both $hWnd and $hCtrl.  Then use AutoIt info tool and check if handles matches.  In info tool, it is the last line (called handle)...

Share this post


Link to post
Share on other sites
Posted (edited)

this is what my script outputs to console, it finds it and says it's clicked, gets a success from ControlClick but it doesn't work. I see what he means

#AutoIt3Wrapper_Compression=3
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#RequireAdmin

#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include 'log4a.au3'
#include 'WaitForControls.au3'

Const $TD_BTN_CONTINUE = 'Continue'

Const $apptext = "Global VPN Client"
Const $text = "Global VPN Client"
Const $class = "[Class:#32770]"
Const $button3 = "[CLASS:Button; INSTANCE:3]"

#Region ;**** Logging ****
; Enable logging and don't write to stderr
_log4a_SetEnable()
; Write to stderr, set min level to warn, customize message format
_log4a_SetErrorStream()
_log4a_SetCompiledOutput($LOG4A_OUTPUT_FILE)
_log4a_SetMinLevel($LOG4A_LEVEL_DEBUG)
; If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled
_log4a_SetFormat("${date} | ${host} | ${level} | ${message}")
#EndRegion ;**** Logging ****

;run("msiexec.exe /X{0E14625B-DF56-4657-8678-DFD1955BE97A} /qb /norestart")

Global $handle = WinActivate($text)
_log4a_Info($text & ' Handle :' & $handle)
_checkClickCtrl($class, $text, $button3, $TD_BTN_CONTINUE, 0)

01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | Control Text Found: Continue
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | Found Formclass: [Class:#32770]
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | Found Text: Global VPN Client
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | Found Control: [CLASS:Button; INSTANCE:3]
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | Found Ctrl Txt: Continue
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | Timeout: 0
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | Time Delay (after click): 0
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | [CLASS:Button; INSTANCE:3]
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | Control [CLASS:Button; INSTANCE:3] return code success: 1
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | ExitLoop:Normal - [CLASS:Button; INSTANCE:3]
01\08\2021 11:34:20 | WIN-ACFPG50M0SU | Info | _checkClickCtrl():End

 

to run my code you need the au3 files in the include, both can be found on this forum. note, you must get to this screen in order to try to execute the script, that installer does other things like removes virtual adapters that have been previously set up. SO just get to that point and execute the script

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites
5 minutes ago, Nine said:

@Earthshine Can you try to ControlSend {TAB} and {SPACE}, see if that works ?

So you can see my udf find the control and attempt to click it, Once the script runs that control is highligted.

I added a Send("{ENTER}") at the very end of the script (even though I was still doing a ControlClick on that beast) and it doesn't do anything.


My resources are limited. You must ask the right questions

 

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...