-
Notifications
You must be signed in to change notification settings - Fork 2
/
UninstallColouredFolders.ahk
56 lines (47 loc) · 1.39 KB
/
UninstallColouredFolders.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#Requires AutoHotkey v2.0
#NoTrayIcon
title := "Coloured Folders - Uninstaller"
Prepare() {
response := MsgBox("Would you like to uninstall the Coloured Folders Shell Extension?", title, "YesNo Icon? Default2")
if (response == "Yes") {
FileCopy "UninstallColouredFolders.exe", A_Temp, 1
Run "*RunAs " . A_Temp . "\UninstallColouredFolders.exe"
}
}
Uninstall() {
install_directory := EnvGet("LocalAppData") . "\ABS\ColouredFolders"
progress := Gui("-MinimizeBox", title)
progress.Add("Progress", "w200 h20 c900000 vBar", 20)
progress.Show()
if (!DirExist(install_directory)) {
MsgBox(
"Uninstallation failed`nCould not find install directory.",
title,
"OK Iconx"
)
ExitApp
} else {
SetWorkingDir install_directory
DirDelete install_directory, 1
progress["Bar"].Value += 20
DirDelete A_Programs . "\Coloured folders", 1
progress["Bar"].Value += 20
}
registry_directory_root := "HKEY_CURRENT_USER\SOFTWARE\Classes\Directory"
registry_main_key := "\shell\ColouredFolders"
for path in ["", "\Background"] {
for key in ["\command", ""] {
reg_path := registry_directory_root . path . registry_main_key . key
RegDeleteKey reg_path
progress["Bar"].Value += 10
}
}
progress.Hide()
MsgBox("Uninstallation complete.", title, "OK Iconi")
ExitApp
}
If (A_ScriptDir == A_Temp) {
Uninstall()
} Else {
Prepare()
}