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