1 |
; example2.nsi |
2 |
; |
3 |
; This script is based on example1.nsi, but it remember the directory, |
4 |
; has uninstall support and (optionally) installs start menu shortcuts. |
5 |
; |
6 |
; It will install example2.nsi into a directory that the user selects, |
7 |
|
8 |
;-------------------------------- |
9 |
|
10 |
; The name of the installer |
11 |
Name "ASCEND PyGTK" |
12 |
|
13 |
; The file to write |
14 |
!ifdef OUTFILE |
15 |
OutFile ${OUTFILE}.exe |
16 |
!else |
17 |
OutFile ascend-setup.exe |
18 |
!endif |
19 |
|
20 |
|
21 |
SetCompressor /SOLID lzma |
22 |
|
23 |
; The default installation directory |
24 |
InstallDir $PROGRAMFILES\ASCEND |
25 |
|
26 |
; Registry key to check for directory (so if you install again, it will |
27 |
; overwrite the old one automatically) |
28 |
InstallDirRegKey HKLM "Software\ASCEND" "Install_Dir" |
29 |
|
30 |
;-------------------------------- |
31 |
|
32 |
; Pages |
33 |
|
34 |
Page components |
35 |
Page directory |
36 |
Page instfiles |
37 |
|
38 |
UninstPage uninstConfirm |
39 |
UninstPage instfiles |
40 |
|
41 |
;-------------------------------- |
42 |
|
43 |
; The stuff to install |
44 |
Section "ASCEND (required)" |
45 |
|
46 |
SectionIn RO |
47 |
|
48 |
; Set output path to the installation directory. |
49 |
SetOutPath $INSTDIR |
50 |
|
51 |
; Put file there |
52 |
File "_ascpy.dll" |
53 |
File "..\ascend.dll" |
54 |
File "config.py" |
55 |
File "*.py" |
56 |
SetOutPath $INSTDIR\glade |
57 |
File "glade\*.glade" |
58 |
File "glade\*.png" |
59 |
SetOutPath $INSTDIR\models |
60 |
File "..\models\*.a4c" |
61 |
File "..\models\*.a4l" |
62 |
SetOutPath $INSTDIR\models\johnpye |
63 |
File "..\models\johnpye\*.a4c" |
64 |
SetOutPath $INSTDIR |
65 |
File "Makefile.bt" |
66 |
File "ascend.syn" |
67 |
|
68 |
WriteINIstr $APPDATA\.ascend.ini Directories librarypath "$DOCUMENTS\ascdata;$INSTDIR\models" |
69 |
|
70 |
ClearErrors |
71 |
FileOpen $0 $INSTDIR\ascend.bat w |
72 |
IfErrors done |
73 |
FileWrite $0 "@echo off" |
74 |
FileWriteByte $0 "13" |
75 |
FileWriteByte $0 "10" |
76 |
FileWrite $0 "set PATH=c:\Python24;c:\GTK\bin" |
77 |
FileWriteByte $0 "13" |
78 |
FileWriteByte $0 "10" |
79 |
FileWrite $0 "cd " |
80 |
FileWrite $0 $INSTDIR |
81 |
FileWriteByte $0 "13" |
82 |
FileWriteByte $0 "10" |
83 |
FileWrite $0 "c:\Python24\python gtkbrowser.py" |
84 |
FileWriteByte $0 "13" |
85 |
FileWriteByte $0 "10" |
86 |
|
87 |
FileClose $0 |
88 |
done: |
89 |
|
90 |
|
91 |
; Write the installation path into the registry |
92 |
WriteRegStr HKLM SOFTWARE\ASCEND "Install_Dir" "$INSTDIR" |
93 |
|
94 |
; Write the uninstall keys for Windows |
95 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "DisplayName" "ASCEND Simulation Environment" |
96 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "UninstallString" '"$INSTDIR\uninstall.exe"' |
97 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoModify" 1 |
98 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoRepair" 1 |
99 |
WriteUninstaller "uninstall.exe" |
100 |
|
101 |
SectionEnd |
102 |
|
103 |
; Optional section (can be disabled by the user) |
104 |
Section "Start Menu Shortcuts" |
105 |
|
106 |
CreateDirectory "$SMPROGRAMS\ASCEND" |
107 |
CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
108 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$INSTDIR\ascend.bat" "" "$INSTDIR\ascend.bat" 0 |
109 |
|
110 |
SectionEnd |
111 |
|
112 |
;-------------------------------- |
113 |
|
114 |
; Uninstaller |
115 |
|
116 |
Section "Uninstall" |
117 |
|
118 |
; Remove registry keys |
119 |
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" |
120 |
DeleteRegKey HKLM SOFTWARE\ASCEND |
121 |
|
122 |
; Remove files and uninstaller |
123 |
Delete $INSTDIR\_ascend.dll |
124 |
Delete $INSTDIR\ascend.bat |
125 |
Delete $INSTDIR\*.py |
126 |
Delete $INSTDIR\glade\* |
127 |
Delete $INSTDIR\Makefile.bt |
128 |
Delete $INSTDIR\ascend.syn |
129 |
Delete $INSTDIR\models\* |
130 |
Delete $INSTDIR\models\johnpye\* |
131 |
RMDir $INSTDIR\models\johnpye |
132 |
RMDIR $INSTDIR\models |
133 |
|
134 |
; Remove shortcuts, if any |
135 |
Delete "$SMPROGRAMS\ASCEND\*.*" |
136 |
|
137 |
; Remove directories used |
138 |
RMDir "$SMPROGRAMS\ASCEND" |
139 |
RMDir "$INSTDIR" |
140 |
|
141 |
SectionEnd |