source: mlx.nsi@ 377:72893c2b24d9

Last change on this file since 377:72893c2b24d9 was 376:51af91103748, checked in by István Váradi <ivaradi@…>, 12 years ago

Fixed the texts (#157)

File size: 5.0 KB
Line 
1; NSIS installer script for MAVA Logger X
2
3;--------------------------------
4;Include Modern UI
5
6 !include "MUI.nsh"
7 !include "nsDialogs.nsh"
8 !include "TextFunc.nsh"
9 !include "mlx-common.nsh"
10
11;--------------------------------
12;General
13
14 Var ApplicationName
15
16 Function .onInit
17 StrCpy $ApplicationName "Mava Logger X"
18 FunctionEnd
19
20 ;Name and file
21 Name "MAVA Logger X"
22 Caption "MAVA Logger X ${MLX_VERSION} Setup"
23 OutFile "MAVA Logger X-${MLX_VERSION}-Setup.exe"
24
25 ;Default installation folder
26 InstallDir "$PROGRAMFILES\MAVA Logger X"
27
28 ;Vista redirects $SMPROGRAMS to all users without this
29 RequestExecutionLevel admin
30
31;--------------------------------
32;Variables
33
34 Var MUI_TEMP
35 Var STARTMENU_FOLDER
36 Var Variable
37 Var Secondary
38 Var Secondary_State
39 Var LinkName
40 Var Parameters
41
42;--------------------------------
43;Interface Settings
44
45 !define MUI_ICON "logo.ico"
46 !define MUI_UNICON "logo_uninst.ico"
47 !define MUI_ABORTWARNING
48
49;--------------------------------
50;Pages
51
52
53 !insertmacro MUI_PAGE_LICENSE "license.txt"
54 Page custom optionsPage ;optionsPageLeave
55 !insertmacro MUI_PAGE_COMPONENTS
56 !insertmacro MUI_PAGE_DIRECTORY
57
58 ;Start Menu Folder Page Configuration
59 ;!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
60 ;!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\MAVA Logger X"
61 ;!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
62
63 !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
64
65 !insertmacro MUI_PAGE_INSTFILES
66
67 !insertmacro MUI_UNPAGE_CONFIRM
68 !insertmacro MUI_UNPAGE_INSTFILES
69
70 Function optionsPage
71 !insertmacro MUI_HEADER_TEXT "Installation Options" "Choose the options for the installation"
72
73 nsDialogs::Create 1018
74 Pop $Variable
75
76 ${If} $Variable == error
77 Abort
78 ${Endif}
79
80 ${NSD_CreateLabel} 0 0 100% 32u "If you select the option below, the program will be installed in a way that it can be used besides another, already existing installation. Its default configuration will be such that it does not conflict with another logger running as a primary one. Normally, you should leave this unchecked."
81 Pop $Variable
82
83 ${NSD_CreateCheckBox} 12 62 100% 12u "Install as a secondary copy"
84 Pop $Secondary
85 ${NSD_SetState} $Secondary $Secondary_State
86 GetFunctionAddress $Variable onSecondaryClicked
87 nsDialogs::onClick $Secondary $Variable
88
89 nsDialogs::Show
90 FunctionEnd
91
92 Function onSecondaryClicked
93 Pop $Secondary
94 ${NSD_GetState} $Secondary $Secondary_State
95 ${If} $Secondary_State == ${BST_CHECKED}
96 StrCpy $INSTDIR "$PROGRAMFILES\MAVA Logger X (Secondary)"
97 StrCpy $STARTMENU_FOLDER "MAVA Logger X (Secondary)"
98 ${Else}
99 StrCpy $INSTDIR "$PROGRAMFILES\MAVA Logger X"
100 StrCpy $STARTMENU_FOLDER "MAVA Logger X"
101 ${EndIf}
102 FunctionEnd
103
104;--------------------------------
105;Languages
106
107 !insertmacro MUI_LANGUAGE "English"
108
109;--------------------------------
110;Installer Sections
111
112Section "MAVA Logger X" SecMLX
113
114 SetOutPath "$INSTDIR"
115
116 ${If} $Secondary_State == ${BST_CHECKED}
117 StrCpy $LinkName "MAVA Logger X (Secondary)"
118 StrCpy $Parameters "secondary"
119 ${Else}
120 StrCpy $LinkName "MAVA Logger X"
121 StrCpy $Parameters ""
122 ${EndIf}
123
124 ;ADD YOUR OWN FILES HERE...
125 File /r dist\*.*
126
127 ;Create the uninstaller config file
128 ${ConfigWrite} "$INSTDIR\Uninstall.conf" "StartMenuFolder=" "$STARTMENU_FOLDER" $Variable
129 ${ConfigWrite} "$INSTDIR\Uninstall.conf" "LinkName=" "$LinkName" $Variable
130
131 ;Create uninstaller
132
133 WriteUninstaller "$INSTDIR\Uninstall.exe"
134
135 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
136 ;Create shortcuts
137 CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
138 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\MAVA Logger X.lnk" "$INSTDIR\runmlx.exe" "$Parameters"
139 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
140 CreateShortCut "$DESKTOP\$LinkName.lnk" "$INSTDIR\runmlx.exe" "$Parameters"
141 !insertmacro MUI_STARTMENU_WRITE_END
142SectionEnd
143
144;--------------------------------
145;Descriptions
146
147 ;Language strings
148 LangString DESC_SecMLX ${LANG_ENGLISH} "MAVA Logger X."
149
150 ;Assign language strings to sections
151 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
152 !insertmacro MUI_DESCRIPTION_TEXT ${SecMLX} $(DESC_SecMLX)
153 !insertmacro MUI_FUNCTION_DESCRIPTION_END
154
155;--------------------------------
156;Uninstaller Section
157
158Section "Uninstall"
159
160 ;Read the uninstaller config file
161 ${ConfigRead} "$INSTDIR\Uninstall.conf" "StartMenuFolder=" $MUI_TEMP
162 ${ConfigRead} "$INSTDIR\Uninstall.conf" "LinkName=" $LinkName
163
164 RMDir /r "$INSTDIR"
165
166 Delete "$DESKTOP\$LinkName.lnk"
167 Delete "$SMPROGRAMS\$MUI_TEMP\MAVA Logger X.lnk"
168 Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
169
170 ;Delete empty start menu parent diretories
171 StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
172
173 startMenuDeleteLoop:
174 ClearErrors
175 RMDir $MUI_TEMP
176 GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
177
178 IfErrors startMenuDeleteLoopDone
179
180 StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
181 startMenuDeleteLoopDone:
182SectionEnd
Note: See TracBrowser for help on using the repository browser.