forked from baycom/MXPTiny
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MXPTiny.nsi
executable file
·186 lines (144 loc) · 5.45 KB
/
MXPTiny.nsi
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
!define MYPRODUCT "BayCom MXPTiny"
!define MYVERSION "0.9.1"
!define VER_MAJOR 0
!define VER_MINOR 9
;OutFile "MXPTiny-${VER_MAJOR}${VER_MINOR}.exe"
OutFile "MXPTinyinstall.exe"
Icon res/MXPTiny.ico
;--------------------------------
;Page license
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
; First is default
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Dutch.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\French.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Korean.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Russian.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Spanish.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Swedish.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\TradChinese.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\SimpChinese.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Slovak.nlf"
;LicenseData "license.txt"
Name "${MYPRODUCT} ${MYVERSION}"
Function .onInit
;Language selection dialog
Push ""
Push ${LANG_ENGLISH}
Push English
Push ${LANG_DUTCH}
Push Dutch
Push ${LANG_FRENCH}
Push French
Push ${LANG_GERMAN}
Push German
Push ${LANG_KOREAN}
Push Korean
Push ${LANG_RUSSIAN}
Push Russian
Push ${LANG_SPANISH}
Push Spanish
Push ${LANG_SWEDISH}
Push Swedish
Push ${LANG_TRADCHINESE}
Push "Traditional Chinese"
Push ${LANG_SIMPCHINESE}
Push "Simplified Chinese"
Push ${LANG_SLOVAK}
Push Slovak
Push A ; A means auto count languages
; for the auto count to work the first empty push (Push "") must remain
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
FunctionEnd
InstallDir "$PROGRAMFILES\BayCom\MXPTiny"
InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\BayCom\MXPTiny" ""
Section "Executables and DLLs (Required)" default
SectionIn RO
retry:
FindProcDLL::FindProc "MXPTiny.exe"
IntCmp $R0 1 0 notRunning
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "MXPTiny is running. Please close it first" /SD IDCANCEL IDRETRY retry IDCANCEL cancel
cancel:
Abort
notRunning:
SetOutPath "$INSTDIR"
; add files / whatever that need to be installed here.
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\BayCom\MXPTiny" "" "$INSTDIR"
WriteRegStr HKEY_LOCAL_MACHINE "Software\BayCom\MXPTiny" "Installer Language" "$LANGUAGE"
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\MXPTiny" "DisplayName" "MXPTiny (remove only)"
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\MXPTiny" "UninstallString" '"$INSTDIR\uninst.exe"'
; write out uninstaller
WriteUninstaller "$INSTDIR\uninst.exe"
File "release\MXPTiny.exe"
File "Preview.xspf"
File "install\vcredist_x86.exe"
; Check if VC10 Redist package is installed
ClearErrors
ReadRegDWORD $0 HKLM SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86\ "Installed"
StrCmp $0 "1" keyexist
ExecWait '"$INSTDIR\vcredist_x86.exe" /passive /norestart'
keyexist:
Delete "$INSTDIR\vcredist_x86.exe"
SetOutPath "$INSTDIR"
;Create Shortcuts
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\MXPTiny"
CreateShortCut "$SMPROGRAMS\MXPTiny\Uninstall.lnk" "$INSTDIR\uninst.exe" "" "$INSTDIR\uninst.exe" 0
CreateShortCut "$SMPROGRAMS\MXPTiny\MXPTiny.lnk" "$INSTDIR\MXPTiny.exe" "" "$INSTDIR\MXPTiny.exe" 0
CreateShortCut "$SMPROGRAMS\MXPTiny\Preview.lnk" "$INSTDIR\Preview.xspf" "" "$INSTDIR\Preview.xspf" 0
SectionEnd ; end of default section
Section "Desktop Menu Shortcut" desktop
CreateShortCut "$DESKTOP\MXPTiny.lnk" "$INSTDIR\MXPTiny.exe" "" "$INSTDIR\MXPTiny.exe" 0
CreateShortCut "$DESKTOP\Preview.lnk" "$INSTDIR\Preview.xspf" "" "$INSTDIR\Preview.xspf" 0
SectionEnd
Section "Quick Launch Menu Shortcut" quicklaunch
SetShellVarContext current
CreateShortCut "$QUICKLAUNCH\MXPTiny.lnk" "$INSTDIR\MXPTiny.exe" "" "$INSTDIR\MXPTiny.exe" 0
CreateShortCut "$QUICKLAUNCH\Preview.lnk" "$INSTDIR\Preview.xspf" "" "$INSTDIR\Preview.xspf" 0
SectionEnd
Section "-post"
SetShellVarContext all
ExecShell open '$SMPROGRAMS\MXPTiny'
Sleep 500
BringToFront
SectionEnd
Function un.onInit
;Get language from registry
ReadRegStr $LANGUAGE HKEY_LOCAL_MACHINE "Software\BayCom\MXPTiny" "Installer Language"
FunctionEnd
Section Uninstall
retry:
FindProcDLL::FindProc "MXPTiny.exe"
IntCmp $R0 1 0 notRunning
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "MXPTiny is running. Please close it first" /SD IDCANCEL IDRETRY retry IDCANCEL cancel
cancel:
Abort
notRunning:
;Remove all files
Delete $INSTDIR\iconengines\*
Delete $INSTDIR\*
RMDir "$INSTDIR\iconengines"
RMDir "$INSTDIR"
; add delete commands to delete whatever files/registry keys/etc you installed here.
Delete "$INSTDIR\uninst.exe"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\BayCom\MXPTiny"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MXPTiny"
;Remove Shortcuts from Menu
SetShellVarContext all
Delete "$SMPROGRAMS\MXPTiny\*.*"
Delete "$DESKTOP\MXPTiny.lnk"
Delete "$DESKTOP\Preview.lnk"
RMDir "$SMPROGRAMS\MXPTiny"
SetShellVarContext current
Delete "$QUICKLAUNCH\MXPTiny.lnk"
Delete "$QUICKLAUNCH\Preview.lnk"
SectionEnd ; end of uninstall section
; eof