summaryrefslogtreecommitdiff
path: root/packaging/Suite/Win32/suite_installer.nsi
blob: 3a95b16898840bc5d70251bbf603f7e0e7cabfba (plain)
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530

; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
; NE1 Defines
!define PRODUCT_NAME "NanoEngineer-1 Suite"
!define PRODUCT_VERSION "1.1.1"
;!define PRODUCT_NICKNAME "(Rattlesnake)"
!define PRODUCT_PUBLISHER "Nanorex, Inc."
!define PRODUCT_WEB_SITE "http://www.nanoengineer-1.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}\${PRODUCT_VERSION}"
;!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\babel.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define NE1_INST_DIR "NanoEngineer-1 v${PRODUCT_VERSION}"

;QMX Defines
!define PRODUCT_QMX_VERSION "0.5.1"
!define PRODUCT_QMX_NAME "QuteMolX"
!define PRODUCT_QMX_PUBLISHER "Nanorex, Inc"
!define PRODUCT_QMX_WEB_SITE "http://www.nanoengineer-1.com/QuteMolX/"
!define PRODUCT_QMX_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_QMX_NAME}\${PRODUCT_QMX_VERSION}"
!define PRODUCT_QMX_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_QMX_NAME}"
!define PRODUCT_QMX_UNINST_ROOT_KEY "HKLM"
!define QMX_INST_DIR "${PRODUCT_QMX_NAME} ${PRODUCT_QMX_VERSION}"

;GMX Defines
!define PRODUCT_GMX_VERSION "3.3.3"
!define PRODUCT_GMX_PATCH_VERSION "p2"
!define PRODUCT_GMX_NAME "GROMACS"
!define PRODUCT_GMX_PUBLISHER "Nanorex, Inc"
!define PRODUCT_GMX_WEB_SITE "http://www.nanorex.com"
!define PRODUCT_GMX_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}\${PRODUCT_GMX_VERSION}"
!define PRODUCT_GMX_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_GMX_UNINST_ROOT_KEY "HKLM"
!define GMX_INST_DIR "GROMACS_${PRODUCT_GMX_VERSION}"

;NV1 Defines
!define PRODUCT_NV1_VERSION "0.1.0"
!define PRODUCT_NV1_NAME "NanoVision-1 ${PRODUCT_NV1_VERSION}"
!define PRODUCT_NV1_PUBLISHER "Nanorex, Inc"
!define PRODUCT_NV1_WEB_SITE "http://www.nanorex.com"
!define PRODUCT_NV1_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\nv1.exe"
!define PRODUCT_NV1_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_NV1_UNINST_ROOT_KEY "HKLM"
!define NV1_INST_DIR "${PRODUCT_NV1_NAME} ${PRODUCT_NV1_VERSION}"

!macro ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT
   Push "${SOURCE_FILE}"
   Push "${SEARCH_TEXT}"
   Push "${REPLACEMENT}"
   Call RIF
!macroend

; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "registerExtension.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "install.ico"
!define MUI_UNICON "uninstall.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "install-header.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "install-header.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "wizard-sidebar.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-sidebar.bmp"

InstType "Basic"
InstType "Full"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "..\..\..\cad\src\dist\Licenses\NanoEngineer-1_License.txt"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\${NE1_INST_DIR}\program\main.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\ReadMe.html"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; MUI end ------

Name "${PRODUCT_NAME} Version v${PRODUCT_VERSION}"
OutFile "..\..\..\cad\src\build\NanoEngineer-1_Suite_v${PRODUCT_VERSION}.exe"
InstallDir "$PROGRAMFILES\Nanorex"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
;InstallDirRegKey HKLM "${PRODUCT_QMX_DIR_REGKEY}" ""
;InstallDirRegKey HKLM "${PRODUCT_GMX_DIR_REGKEY}" ""
;InstallDirRegKey HKLM "${PRODUCT_NV1_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

SectionGroup /e "NanoEngineer-1 Suite Installer"

SectionGroup /e "NanoEngineer-1"
Section "NanoEngineer-1 Program" SECNE1
  SectionIn 1 2
  SetOutPath "$INSTDIR\${NE1_INST_DIR}"
  SetOverwrite try
  File "..\..\..\cad\src\dist\ReadMe.html"
  SetOutPath "$INSTDIR"
  File "..\Readme.html"
  SetOverwrite try
  SetOutPath "$INSTDIR\${NE1_INST_DIR}\bin"
  File /r "..\..\..\cad\src\dist\bin\*"
  SetOutPath "$INSTDIR\${NE1_INST_DIR}\doc"
  File /r "..\..\..\cad\src\dist\doc\*"
  SetOutPath "$INSTDIR\${NE1_INST_DIR}\Licenses"
  File /r "..\..\..\cad\src\dist\Licenses\*"
  SetOutPath "$INSTDIR\${NE1_INST_DIR}\partlib"
  File /r "..\..\..\cad\src\dist\partlib\*"
  SetOutPath "$INSTDIR\${NE1_INST_DIR}\plugins"
  File /r "..\..\..\cad\src\dist\plugins\*"
  SetOutPath "$INSTDIR\${NE1_INST_DIR}\program"
  File /r "..\..\..\cad\src\dist\program\*"
  SetOutPath "$INSTDIR\${NE1_INST_DIR}\src"
  File /r "..\..\..\cad\src\dist\src\*"
  
  ; hack
  SetOutPath "$INSTDIR\${NE1_INST_DIR}\program"
  File "C:\Qt\4.3.5\bin\QtSvg4.dll"
  
  SetOutPath "$SYSDIR"
  SetOverwrite off
  File "..\..\Win32\glut32.dll"
  File "..\..\Win32\gle32.dll"
  CreateDirectory "$SMPROGRAMS\Nanorex\${NE1_INST_DIR}"
  CreateShortCut "$SMPROGRAMS\Nanorex\${NE1_INST_DIR}\NanoEngineer-1.lnk" "$INSTDIR\${NE1_INST_DIR}\program\main.exe"
  CreateShortCut "$DESKTOP\NanoEngineer-1.lnk" "$INSTDIR\${NE1_INST_DIR}\program\main.exe"
  CreateShortCut "$SMPROGRAMS\${NE1_INST_DIR}\ReadMe.html.lnk" "$INSTDIR\${NE1_INST_DIR}\ReadMe.html"
  SetOutPath "$INSTDIR"
  SetOutPath "$INSTDIR\Pref_Mod"
  File /r "..\..\Pref_mod\dist\*"
  SetOutPath "$INSTDIR"
SectionEnd
Section /o "Source" SEC_NE1_SRC
  SectionIn 2
  SetOutPath "$INSTDIR\${NE1_INST_DIR}\source"
  SetOverwrite try
  File /r "..\..\..\cad\src\dist\source\*"
  SetOutPath "$INSTDIR"
SectionEnd
SectionGroupEnd

SectionGroup /e "QuteMolX"
Section "QuteMolX (Required)" SEC_QMX_BASE
  SectionIn 1 2
  SetOutPath "$INSTDIR\${QMX_INST_DIR}"
  SetOverwrite try
  File "\QMX_Install\License.txt"
  File "\QMX_Install\ReadMe.html"
  File "\QMX_Install\build\*"
  SetOutPath "$INSTDIR\${QMX_INST_DIR}\image"
  File "\QMX_INSTALL\build\image\*"
  SetOutPath "$INSTDIR\${QMX_INST_DIR}\presets"
  File "\QMX_Install\build\presets\*"
  SetOutPath "$INSTDIR\${QMX_INST_DIR}"
  CreateDirectory "$SMPROGRAMS\Nanorex\${QMX_INST_DIR}"
  CreateShortCut "$SMPROGRAMS\Nanorex\${QMX_INST_DIR}\QuteMolX.lnk" "$INSTDIR\${QMX_INST_DIR}\QuteMolX.exe"
  CreateShortCut "$DESKTOP\QuteMolX.lnk" "$INSTDIR\${QMX_INST_DIR}\QuteMolX.exe"
  ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k qutemol_enabled -v True'
  ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k qutemol_path -v "$INSTDIR\${QMX_INST_DIR}\QuteMolX.exe"'
  SetOutPath "$INSTDIR"
SectionEnd
Section /o "Source" SEC_QMX_SRC
  SectionIn 2
  SetOutPath "$INSTDIR\${QMX_INST_DIR}\source"
  SetOverwrite try
  File /r "\QMX_Install\source\*"
  SetOutPath "$INSTDIR"
SectionEnd
SectionGroupEnd

;SectionGroup /e "NanoVision-1"
;Section "NanoVision-1 Base" NV1_BASE
;  SetOutPath "$INSTDIR\${NV1_INST_DIR}\bin"
;  SetOverwrite try
;  File "\NV1_Install\bin\*"
;  CreateDirectory "$SMPROGRAMS\Nanorex\${NV1_INST_DIR}"
;  CreateShortCut "$SMPROGRAMS\Nanorex\${NV1_INST_DIR}\NanoVision-1.lnk" "$INSTDIR\${NV1_INST_DIR}\bin\nv1.exe"
;  CreateShortCut "$DESKTOP\NanoVision-1.lnk" "$INSTDIR\${NV1_INST_DIR}\bin\nv1.exe"
;  SetOutPath "$INSTDIR\${NV1_INST_DIR}\include"
;  File /r "\NV1_Install\include\*"
;  SetOutPath "$INSTDIR\${NV1_INST_DIR}\lib"
;  File /r "\NV1_Install\lib\*"
;  SetOutPath "$INSTDIR\${NV1_INST_DIR}"
;  SetOverwrite  on
;  File "\NV1_Install\ReadMe.html"
;  File "\NV1_Install\License.txt"

;  SetOutPath "$APPDATA\Nanorex\NanoVision-1"
;  File "\NV1_Install\NanoVision-1.ini"
;  Push "$INSTDIR\${NV1_INST_DIR}\lib"
;  Push "\"
;  Push "/"
;  Call StrRep
;  Pop "$R0" ;result
;  !insertmacro ReplaceInFile "$APPDATA\Nanorex\NanoVision-1\NanoVision-1.ini" "@PLUGSRCHPATH@" "$R0"

;  SetOutPath "$APPDATA\Nanorex\NanoVision-1"
;  File "\NV1_Install\NanoVision-1.ini"
;  Push "$INSTDIR\NanoVision-1\lib"
;  Push "\"
;  Push "/"
;  Call StrRep
;  Pop "$R0" ;result
;  !insertmacro ReplaceInFile "$APPDATA\Nanorex\NanoVision-1.ini" "@PLUGSRCHPATH@" "$R0"

;  ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe -k nv1_enabled -v True"'
;  ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe -k nv1_path -v $INSTDIR\${NV1_INST_PATH}\nv1.exe"
;  SetOutPath "$INSTDIR"
;SectionEnd

;Section /o "source" NV1_SRC
;  SetOutPath "$INSTDIR\${NV1_INST_DIR}\source"
;  File /r "\NV1_Install\src\*"
;SectionEnd
;SectionGroupEnd

SectionGroup /e "GROMACS"
Section "GROMACS (Required)" SEC_GMX_BASE
  SectionIn 1 2
;  SetOutPath "$INSTDIR"
  SetOutPath "c:\${GMX_INST_DIR}"
  SetOverwrite try
  File "\GMX_Install\ReadMe.html"
  File "\GMX_Install\.\License.txt"
  SetOutPath "c:\${GMX_INST_DIR}\bin"
  SetOverwrite try
  File "\GMX_Install\dist\bin\*"
  ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k gromacs_enabled -v True"'
  ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k gromacs_path -v "c:\${GMX_INST_DIR}\bin\mdrun.exe"'
SectionEnd
Section /o "Headers & Libraries" SEC_GMX_LIBHDR
  SectionIn 2
  SetOutPath "c:\${GMX_INST_DIR}\include\gromacs"
  File "\GMX_Install\dist\include\gromacs\*"
  SetOutPath "c:\${GMX_INST_DIR}\include\gromacs\types"
  File "\GMX_Install\dist\include\gromacs\types\*"
  SetOutPath "c:\${GMX_INST_DIR}\include\gromacs"
  File "\GMX_Install\dist\include\gromacs\*"
  SetOutPath "c:\${GMX_INST_DIR}\lib"
  File "\GMX_Install\dist\lib\*"
SectionEnd
Section "Documentation" SEC_GMX_DOC
  SectionIn 1 2
  SetOverwrite try
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\html"
  File "\GMX_Install\dist\share\gromacs\html\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\html\images"
  File "\GMX_Install\dist\share\gromacs\html\images\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\html\online"
  File "\GMX_Install\dist\share\gromacs\html\online\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\template"
  File "\GMX_Install\dist\share\gromacs\template\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\top"
  File "\GMX_Install\dist\share\gromacs\top\*"
SectionEnd
Section "Tutorials" SEC_GMX_TUTOR
  SectionIn 1 2
  SetOverwrite try
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\tutor"
  File "\GMX_Install\dist\share\gromacs\tutor\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\tutor\gmxdemo"
  File "\GMX_Install\dist\share\gromacs\tutor\gmxdemo\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\tutor\methanol"
  File "\GMX_Install\dist\share\gromacs\tutor\methanol\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\tutor\mixed"
  File "\GMX_Install\dist\share\gromacs\tutor\mixed\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\tutor\nmr1"
  File "\GMX_Install\dist\share\gromacs\tutor\nmr1\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\tutor\nmr2"
  File "\GMX_Install\dist\share\gromacs\tutor\nmr2\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\tutor\speptide"
  File "\GMX_Install\dist\share\gromacs\tutor\speptide\*"
  SetOutPath "c:\${GMX_INST_DIR}\share\gromacs\tutor\water"
  File "\GMX_Install\dist\share\gromacs\tutor\water\*"
SectionEnd
Section /o "Source" SEC_GMX_SRC
  SectionIn 2
  SetOverwrite try
  SetOutPath "c:\${GMX_INST_DIR}\source"
  file /r "\GMX_Install\dist\src\gromacs-3.3.3\*"
SectionEnd
SectionGroupEnd

SectionGroup /e "MCPP"
Section "MCPP (Required)" SEC_MCPP
  SectionIn 1 2
  SetOutPath "c:\${GMX_INST_DIR}\MCPP\bin"
  File "\GMX_Install\mcpp\bin\mcpp.exe"
  SetOutPath "c:\${GMX_INST_DIR}\MCPP"
  File "\GMX_Install\mcpp\LICENSE"
  File "\GMX_Install\mcpp\mcpp-manual-jp.html"
  File "\GMX_Install\mcpp\mcpp-manual.html"
  File "\GMX_Install\mcpp\NEWS"
  File "\GMX_Install\mcpp\README"
  ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k cpp_enabled -v True'
  ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k cpp_path -v "c:\${GMX_INST_DIR}\mcpp\bin\mcpp.exe"'
SectionEnd
Section /o "Source" SEC_MCPP_SRC
  SectionIn 2
  SetOutPath "c:\${GMX_INST_DIR}\mcpp\source"
  File /r "\GMX_Install\mcpp\source\*"
SectionEnd
SectionGroupEnd

SectionGroupEnd

Section -AdditionalIcons
  SetOutPath $INSTDIR
  CreateShortCut "$SMPROGRAMS\Nanorex\NanoEngineer-1 v${PRODUCT_VERSION}\partlib.lnk" "$INSTDIR\NanoEngineer-1 v${PRODUCT_VERSION}\partlib"
  CreateShortCut "$SMPROGRAMS\Nanorex\NanoEngineer-1 v${PRODUCT_VERSION}\Licenses.lnk" "$INSTDIR\NanoEngineer-1 v${PRODUCT_VERSION}\Licenses"
  CreateShortCut "$SMPROGRAMS\Nanorex\NanoEngineer-1 v${PRODUCT_VERSION}\Uninstall.lnk" "$INSTDIR\uninst.exe"
;  WriteIniStr "$INSTDIR\NanoVision-1\${PRODUCT_NV1_NAME}-${PRODUCT_NV1_VERSION.url" "InternetShortcut" "URL" "${PRODUCT_NV1_WEB_SITE}"
;  CreateShortCut "$SMPROGRAMS\Nanorex\NanoVision-1\Website.lnk" "$INSTDIR\NanoVision-1\${PRODUCT_NV1_NAME}.url"
  WriteIniStr "$INSTDIR\${QMX_INST_DIR}\${PRODUCT_QMX_NAME}-${PRODUCT_QMX_VERSION}.url" "InternetShortcut" "URL" "${PRODUCT_QMX_WEB_SITE}"
  CreateShortCut "$SMPROGRAMS\Nanorex\${QMX_INST_DIR}\Website.lnk" "$INSTDIR\${QMX_INST_DIR}\${PRODUCT_QMX_NAME}-${PRODUCT_QMX_VERSION}.url"
SectionEnd

Section -Post
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\program\main.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\${NE1_INST_DIR}\program\main.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
  ${registerExtension} "$INSTDIR\${NE1_INST_DIR}\program\main.exe " ".mmp" "NanoEngineer-1 File"
SectionEnd


Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
  Abort
FunctionEnd

Section Uninstall
  Delete "$INSTDIR\*"
  RMDir /r "$INSTDIR\src"
;  RMDir /r "$INSTDIR\program"
;  RMDir /r "$INSTDIR\plugins"
;  RMDir /r "$INSTDIR\partlib"
;  RMDir /r "$INSTDIR\Licenses"
;  RMDir /r "$INSTDIR\doc"
;  RMDir /r "$INSTDIR\bin"
  RMDIR /r "$INSTDIR\${NE1_INST_DIR}"
  RMDIR /r "$INSTDIR\${QMX_INST_DIR}"
  RMDIR /r "$INSTDIR\${GMX_INST_DIR}"
;  RMDIR /r "$INSTDIR\${NV1_INST_DIR}"
  RMDir /r "$INSTDIR"
  RMDir /r "C:\${GMX_INST_DIR}"

  Delete "$DESKTOP\NanoEngineer-1.lnk"
  Delete "$DESKTOP\NanoVision-1.lnk"
  Delete "$DESKTOP\QuteMolX.lnk"

  RMDir /r "$SMPROGRAMS\Nanorex\${NE1_INST_DIR}"
  RMDir /r "$SMPROGRAMS\Nanorex\${QMX_INST_DIR}"
;  RMDir /r "$SMPROGRAMS\Nanorex\${NV1_INST_DIR}"
  RMDir /r "$SMPROGRAMS\Nanorex"

  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  ${unregisterExtension} ".mmp" "NanoEngineer-1 File"
  SetAutoClose true

SectionEnd

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function RIF
  ClearErrors  ; wanna be a newborn

  Exch $0      ; REPLACEMENT
  Exch
  Exch $1      ; SEARCH_TEXT
  Exch 2
  Exch $2      ; SOURCE_FILE

  Push $R0     ; SOURCE_FILE file handle
  Push $R1     ; temporary file handle
  Push $R2     ; unique temporary file name
  Push $R3     ; a line to sar/save
  Push $R4     ; shift puffer

  IfFileExists $2 +1 RIF_error      ; knock-knock
  FileOpen $R0 $2 "r"               ; open the door

  GetTempFileName $R2               ; who's new?
  FileOpen $R1 $R2 "w"              ; the escape, please!

  RIF_loop:                         ; round'n'round we go
    FileRead $R0 $R3                ; read one line
    IfErrors RIF_leaveloop          ; enough is enough
    RIF_sar:                        ; sar - search and replace
      Push "$R3"                    ; (hair)stack
      Push "$1"                     ; needle
      Push "$0"                     ; blood
      Call StrReplace               ; do the bartwalk
      StrCpy $R4 "$R3"              ; remember previous state
      Pop $R3                       ; gimme s.th. back in return!
      StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again!
    FileWrite $R1 "$R3"             ; save the newbie
  Goto RIF_loop                     ; gimme more

  RIF_leaveloop:                    ; over'n'out, Sir!
    FileClose $R1                   ; S'rry, Ma'am - clos'n now
    FileClose $R0                   ; me 2

    Delete "$2.old"                 ; go away, Sire
    Rename "$2" "$2.old"            ; step aside, Ma'am
    Rename "$R2" "$2"               ; hi, baby!
    Delete "$2.old"                 ; Nano-Hive addition

    ClearErrors                     ; now i AM a newborn
    Goto RIF_out                    ; out'n'away

  RIF_error:                        ; ups - s.th. went wrong...
    SetErrors                       ; ...so cry, boy!

  RIF_out:                          ; your wardrobe?
  Pop $R4
  Pop $R3
  Pop $R2
  Pop $R1
  Pop $R0
  Pop $2
  Pop $0
  Pop $1
FunctionEnd

Function StrReplace
  Exch $0 ;this will replace wrong characters
  Exch
  Exch $1 ;needs to be replaced
  Exch
  Exch 2
  Exch $2 ;the orginal string
  Push $3 ;counter
  Push $4 ;temp character
  Push $5 ;temp string
  Push $6 ;length of string that need to be replaced
  Push $7 ;length of string that will replace
  Push $R0 ;tempstring
  Push $R1 ;tempstring
  Push $R2 ;tempstring
  StrCpy $3 "-1"
  StrCpy $5 ""
  StrLen $6 $1
  StrLen $7 $0
  Loop:
  IntOp $3 $3 + 1
  StrCpy $4 $2 $6 $3
  StrCmp $4 "" ExitLoop
  StrCmp $4 $1 Replace
  Goto Loop
  Replace:
  StrCpy $R0 $2 $3
  IntOp $R2 $3 + $6
  StrCpy $R1 $2 "" $R2
  StrCpy $2 $R0$0$R1
  IntOp $3 $3 + $7
  Goto Loop
  ExitLoop:
  StrCpy $0 $2
  Pop $R2
  Pop $R1
  Pop $R0
  Pop $7
  Pop $6
  Pop $5
  Pop $4
  Pop $3
  Pop $2
  Pop $1
  Exch $0
FunctionEnd

Function StrRep
  Exch $R4 ; $R4 = Replacement String
  Exch
  Exch $R3 ; $R3 = String to replace (needle)
  Exch 2
  Exch $R1 ; $R1 = String to do replacement in (haystack)
  Push $R2 ; Replaced haystack
  Push $R5 ; Len (needle)
  Push $R6 ; len (haystack)
  Push $R7 ; Scratch reg
  StrCpy $R2 ""
  StrLen $R5 $R3
  StrLen $R6 $R1
loop:
  StrCpy $R7 $R1 $R5
  StrCmp $R7 $R3 found
  StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1
  StrCpy $R2 "$R2$R7"
  StrCpy $R1 $R1 $R6 1
  StrCmp $R1 "" done loop
found:
  StrCpy $R2 "$R2$R4"
  StrCpy $R1 $R1 $R6 $R5
  StrCmp $R1 "" done loop
done:
  StrCpy $R3 $R2
  Pop $R7
  Pop $R6
  Pop $R5
  Pop $R2
  Pop $R1
  Pop $R4
  Exch $R3
FunctionEnd