-
Notifications
You must be signed in to change notification settings - Fork 0
/
snpad-nsi-installer-script.nsi
92 lines (65 loc) · 3.47 KB
/
snpad-nsi-installer-script.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
Name "SNotepad"
OutFile "fgroupindonesia\released\Setup_SNotepad_v1.0.0.1.exe"
InstallDir "$PROGRAMFILES\fgroupindonesia\SNotepad"
DirText "Please choose a directory to which you'd like to install this application."
; ----------------------------------------------------------------------------------
; *************************** SECTION FOR INSTALLING *******************************
; ----------------------------------------------------------------------------------
Section "" ; A "useful" name is not needed as we are not installing separate components
; Set output path to the installation directory. Also sets the working
; directory for shortcuts
SetOutPath $INSTDIR\
File fgroupindonesia\snotepad.exe
File fgroupindonesia\snotepad.ico
File fgroupindonesia\snpad-engine.jar
WriteUninstaller $INSTDIR\Uninstall.exe
MessageBox MB_YESNO "Add Supplemental JRE Engine for SNotepad?" IDYES true IDNO false
true:
SetOutPath $APPDATA\fgroupindonesia\
File fgroupindonesia\jdk-11-mini-jre.exe
ExecWait "$APPDATA\fgroupindonesia\jdk-11-mini-jre.exe"
File fgroupindonesia\engine-to-path-win.bat
ExecWait "$APPDATA\fgroupindonesia\engine-to-path-win.bat"
DetailPrint "installing supplementall success!"
Goto next
false:
DetailPrint "skipping supplementall installation!"
next:
DetailPrint "Now creating shortcuts..."
; ///////////////// CREATE SHORT CUTS //////////////////////////////////////
CreateDirectory "$SMPROGRAMS\fgroupindonesia\SNotepad"
CreateShortCut "$SMPROGRAMS\fgroupindonesia\SNotepad\snotepad.lnk" "$INSTDIR\snotepad.exe"
CreateShortCut "$SMPROGRAMS\fgroupindonesia\SNotepad\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
; ///////////////// END CREATING SHORTCUTS //////////////////////////////////
; //////// CREATE REGISTRY KEYS FOR ADD/REMOVE PROGRAMS IN CONTROL PANEL /////////
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SNotepad" "DisplayName" "SNotepad (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SNotepad" "DisplayIcon" "$INSTDIR\snotepad.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SNotepad" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SNotepad" "QuietUninstallString" '"$INSTDIR\Uninstall.exe" /S'
; //////////////////////// END CREATING REGISTRY KEYS ////////////////////////////
MessageBox MB_OK "Installation was successful."
SectionEnd
; ----------------------------------------------------------------------------------
; ************************** SECTION FOR UNINSTALLING ******************************
; ----------------------------------------------------------------------------------
Section "Uninstall"
; remove all the files and folders
Delete $INSTDIR\Uninstall.exe ; delete self
Delete $INSTDIR\snotepad.exe
Delete $INSTDIR\snotepad.ico
Delete $INSTDIR\snpad-engine.jar
RMDir $INSTDIR
; now remove all the startmenu links
Delete "$SMPROGRAMS\fgroupindonesia\SNotepad\snotepad.lnk"
Delete "$SMPROGRAMS\fgroupindonesia\SNotepad\Uninstall.lnk"
RMDIR "$SMPROGRAMS\fgroupindonesia\SNotepad"
RMDIR "$SMPROGRAMS\fgroupindonesia"
; now remove all the supplemental files
Delete "$APPDATA\fgroupindonesia\jdk-11-mini-jre.exe"
Delete "$APPDATA\fgroupindonesia\engine-to-path-win.bat"
RMDIR /r "$APPDATA\fgroupindonesia\jdk-11-mini-jre"
RMDIR /r "$APPDATA\fgroupindonesia\snpad"
; Now delete registry keys
DeleteRegKey HKLM "SOFTWARE\SNotepad"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SNotepad"
SectionEnd