-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2308 from brogers5/opera/ahk-uninstall
- Loading branch information
Showing
4 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#Requires AutoHotkey v2.0 | ||
#NoTrayIcon | ||
#SingleInstance Force | ||
#Warn | ||
DetectHiddenText "Off" | ||
DetectHiddenWindows "Off" | ||
SetControlDelay 20 | ||
SendMode "Input" | ||
SetTitleMatchMode 3 ;Exact | ||
SetWinDelay 100 | ||
|
||
ShouldRemoveUserData := False | ||
for i, param in A_Args | ||
{ | ||
if (!StrCompare("/RemoveUserData", param)) | ||
{ | ||
ShouldRemoveUserData := True | ||
break | ||
} | ||
} | ||
|
||
UninstallerProcessName := "installer.exe" | ||
MainWindowClass := "InstallerMainWindow" | ||
MainWindowTitle := "ahk_class " MainWindowClass " ahk_exe " UninstallerProcessName | ||
WinWait MainWindowTitle | ||
|
||
if (ShouldRemoveUserData) | ||
{ | ||
RemoveUserDataCheckbox := "Button12" | ||
;For some reason, neither ControlClick nor ControlSetChecked will tick the checkbox | ||
ControlSend "{Space}", RemoveUserDataCheckbox, MainWindowTitle | ||
} | ||
|
||
UninstallButton := "Button3" | ||
;This window's buttons may not work reliably with ControlClick if mouse-up events are delayed. | ||
;Send spaces with ControlSend instead for increased reliability. | ||
ControlSend "{Space}", UninstallButton, MainWindowTitle | ||
|
||
;If the user has launched Opera at least once, a survey page may show up. | ||
Sleep 200 | ||
FirstRadioButton := "Button13" ;The positioning of each option is randomized and may vary | ||
SurveyPageVisible := ControlGetVisible(FirstRadioButton, MainWindowTitle) | ||
if (SurveyPageVisible) { | ||
;Skip over the survey | ||
ControlSend "{Space}", UninstallButton, MainWindowTitle | ||
} | ||
|
||
DialogWindowClass := "#32770" | ||
DialogWindowTitle := "ahk_class " DialogWindowClass " ahk_exe " UninstallerProcessName | ||
WinWait DialogWindowTitle | ||
|
||
YesButton := "Button1" | ||
ControlClick YesButton, DialogWindowTitle,,,, "NA" | ||
|
||
TryAgainButton := "Button6" | ||
while !WinWaitClose(MainWindowTitle,, 1) { | ||
try { | ||
TryAgainButtonVisible := ControlGetVisible(TryAgainButton, MainWindowTitle) | ||
if (TryAgainButtonVisible) { | ||
;Allow the user an opportunity to see the uninstaller has failed, then try again | ||
Sleep 2000 | ||
ControlSend "{Space}", TryAgainButton, MainWindowTitle | ||
} | ||
} | ||
} | ||
|
||
ExitApp |