-
Notifications
You must be signed in to change notification settings - Fork 0
/
InstallScript.nsi
75 lines (48 loc) · 1.88 KB
/
InstallScript.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
!include "MUI2.nsh"
!define APP_VERSION "1_04_04"
!define APP_NAME "GrabNDrop"
!define GND_BASEPATH "C:\Users\y\Dropbox\Projects\VisualStudio\GrabNDrop\"
Name "${APP_NAME}"
OutFile ".\install\${APP_NAME}_${APP_VERSION}_Setup.exe"
ShowInstDetails show
#LicenseData "License.txt"
;Default installation folder
InstallDir "$PROGRAMFILES\GrabNDrop"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\GrabNDrop" ""
Var StartMenuFolder
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU "Application" $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_INSTFILES
Section
SetOutPath "$INSTDIR"
FindProcDLL::FindProc "GrabNDrop.exe"
StrCmp $R0 1 killProc resume
killProc:
DetailPrint "Stopping Running Process..."
KillProcDLL::KillProc "GrabNDrop.exe"
StrCmp $R0 1 resume resume
resume:
File "${GND_BASEPATH}GrabNSend\bin\Release\GrabNDrop.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GrabNDrop.lnk" "$INSTDIR\GrabNDrop.exe"
!insertmacro MUI_STARTMENU_WRITE_END
# create the uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
Exec "$INSTDIR\GrabNDrop.exe"
SectionEnd
Section "Uninstall"
Delete "$INSTDIR\GrabNDrop.exe"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\GrabNDrop.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
Delete "$DESKTOP\GrabNDrop.lnk"
DeleteRegKey HKLM "Software\GrabNDrop"
SectionEnd