-
Notifications
You must be signed in to change notification settings - Fork 18
/
uninstall.ahk
131 lines (111 loc) · 2.89 KB
/
uninstall.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
; Defaults
ListLines Off
SetBatchLines -1
DetectHiddenWindows On
Process Priority,, High
; Arguments
verbose := !quiet := false
if (A_Args[1] ~= "i)-quiet")
verbose := !quiet := true
if (verbose)
{
Alert_Labels("", "&Exit")
msg := "Do you want to uninstall Bitwarden Auto-Type?"
Alert(0x134, "Uninstall?", msg)
IfMsgBox No ; Relabeled as `Exit`
ExitApp
}
WinKill ahk_exe bw-at.exe
remove := 1
if (verbose)
{
Alert(0x24, "Remove?", "Do you want to remove the stored Settings?")
IfMsgBox No
remove := 0
}
; Execute from %TEMP%
if (A_IsCompiled && !InStr(A_ScriptDir, A_Temp))
{
tmp := A_Temp "\bw-at-uninstall.tmp"
FileCopy % A_ScriptFullPath, % tmp, % true
Run % tmp " -quiet:" remove
ExitApp
}
; User settings
if (A_Args[1] ~= ":1")
{
EnvGet public, PUBLIC
loop files, % public "\..\*", D
{
dir := A_LoopFileLongPath "\AppData\Roaming\Auto-Type"
FileRemoveDir % dir, % true
}
}
; Application and start menu
for i,dir in [ A_ProgramFiles "\Auto-Type"
, A_AppDataCommon "\Microsoft\Windows\Start Menu\Programs\Auto-Type"]
{
FileRemoveDir % dir, % true
if (ErrorLevel)
DllCall("Kernel32\MoveFileEx", "Str",dir, "Ptr",0, "UInt",0x4)
}
; Desktop shortcut
FileDelete % A_DesktopCommon "\Auto-Type.lnk"
; Autorun
users := []
loop reg, HKU, K
users.Push(A_LoopRegName)
for i,user in users
{
RegDelete % "HKU\" user "\Software\Microsoft\Windows\CurrentVersion\Run"
, Bitwarden Auto-Type
}
; Uninstall info
RegDelete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Auto-Type
; Remove certificate
Run % "PowerShell -Command " Quote("Get-ChildItem Cert:\LocalMachine\*\* | "
. "Where-Object {$_.Subject -like 'CN=Auto-Typ*'} | Remove-Item"),, Hide
; Acknowledge
if (verbose)
Alert(0x40, "Complete!", "Bitwarden Auto-Type has been uninstalled.")
; Self-destruct
if (A_IsCompiled)
{
Run % A_ComSpec " /C " Quote("timeout /t 1 & del "
. Quote(A_ScriptFullPath)),, Hide ErrorLevel
if (ErrorLevel)
{
DllCall("Kernel32\MoveFileEx"
, "Str",A_ScriptFullPath
, "Ptr",0
, "UInt",0x4)
}
}
ExitApp
#NoEnv
#NoTrayIcon
#KeyHistory 0
;@Ahk2Exe-IgnoreBegin
#SingleInstance Force
#Warn All, OutputDebug
;@Ahk2Exe-IgnoreEnd
/*@Ahk2Exe-Keep
#SingleInstance Ignore
*/
; Includes
#Include %A_ScriptDir%
;@Ahk2Exe-Base %A_ScriptDir%\assets\bw-at.bin, uninstall.exe, CP65001
;@Ahk2Exe-SetCompanyName u/anonymous1184
;@Ahk2Exe-SetCopyright Copyleft 2020
;@Ahk2Exe-SetDescription Bitwarden Auto-Type Uninstaller
;@Ahk2Exe-SetLanguage 0x0409
;@Ahk2Exe-SetMainIcon %A_ScriptDir%\assets\uninstall.ico
;@Ahk2Exe-SetName Bitwarden Auto-Type
;@Ahk2Exe-SetOrigFilename uninstall.ahk
;@Ahk2Exe-SetProductVersion 1.1.4.3
;@Ahk2Exe-SetVersion 1.1.4.3
;@Ahk2Exe-UpdateManifest 1, Auto-Type, 1.1.4.3, 0
; BinMod
;@Ahk2Exe-PostExec "%A_ScriptDir%\assets\BinMod.exe" "%A_WorkFileName%"
;@Ahk2Exe-Cont "22.>AUTOHOTKEY SCRIPT<.$APPLICATION SOURCE"
;@Ahk2Exe-PostExec "%A_ScriptDir%\assets\BinMod.exe" "%A_WorkFileName%" /SetUTC