1!define PRODUCT_NAME "PRODUCTNAMEPLACEHOLDER" 2!define PRODUCT_VERSION "PRODUCTVERSIONPLACEHOLDER" 3!define PRODUCT_PUBLISHER "PUBLISHERPLACEHOLDER" 4!define PRODUCT_WEB_SITE "WEBSITEPLACEHOLDER" 5 6; Enable Unicode 7Unicode true 8 9; SetCompressor lzma 10SetCompressor zlib 11 12; MUI 1.67 compatible ------ 13!include "MUI.nsh" 14 15Function .onInit 16 17 Call GetParameters 18 Pop $1 19 ;MessageBox MB_OK "$1" 20 21 Push $1 22 Push "/HELP=" 23 Call GetOptions 24 Pop $2 25 ;MessageBox MB_OK "HELP: $2" 26 27 StrCmp $2 "ON" showhelp nohelp 28 showhelp: 29 MessageBox MB_OK|MB_ICONINFORMATION \ 30 "DOWNLOADNAMEPLACEHOLDER options: $\n $\n \ 31 /S : Silent installation $\n \ 32 /D=<path> : NSIS installation directory (must be the last option!) $\n \ 33 /EXTRACTONLY=ON : NSIS only extracts the PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation set $\n \ 34 /INSTALLLOCATION=<path> : PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation directory $\n \ 35 /POSTREMOVE=ON : Removes the unpacked installation set after PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation $\n \ 36 /INSTALLJAVA=ON : Installs JRE located in sub directory java, if exists $\n \ 37 /GUILEVEL=<guilevel> : Setting Windows Installer GUI level: qr, qb, qn, qf, ... $\n \ 38 /PARAM1=$\"key=value$\" : Flexible parameter 1. Example: /PARAM1=$\"INSTALLLEVEL=70$\" $\n \ 39 /PARAM2=$\"key=value$\" : Flexible parameter 2. $\n \ 40 /PARAM3=$\"key=value$\" : Flexible parameter 3. $\n \ 41 /HELP=ON : Shows this help $\n" 42 Quit 43 GoTo onInitDone 44 45 nohelp: 46 47 StrCmp $INSTDIR "" pathnotset pathset 48 pathnotset: 49 50 IfSilent onInitSilent onInitNoSilent 51 52 onInitSilent: 53 StrCpy $INSTDIR "$TEMP\PRODUCTPATHPLACEHOLDER Installation Files" 54 GoTo onInitDone 55 56 onInitNoSilent: 57 StrCpy $INSTDIR "$DESKTOP\PRODUCTPATHPLACEHOLDER Installation Files" 58 GoTo onInitDone 59 60 onInitDone: 61 pathset: 62 63FunctionEnd 64 65Function GetParameters 66 67 Push $R0 68 Push $R1 69 Push $R2 70 Push $R3 71 72 StrCpy $R2 1 73 74 StrLen $R3 $CMDLINE 75 76 ;Check for quote or space 77 StrCpy $R0 $CMDLINE $R2 78 79 StrCmp $R0 '"' 0 +3 80 StrCpy $R1 '"' 81 Goto loop 82 StrCpy $R1 " " 83 84 loop: 85 IntOp $R2 $R2 + 1 86 StrCpy $R0 $CMDLINE 1 $R2 87 StrCmp $R0 $R1 get 88 StrCmp $R2 $R3 get 89 Goto loop 90 91 get: 92 IntOp $R2 $R2 + 1 93 StrCpy $R0 $CMDLINE 1 $R2 94 StrCmp $R0 " " get 95 StrCpy $R0 $CMDLINE "" $R2 96 97 Pop $R3 98 Pop $R2 99 Pop $R1 100 Exch $R0 101 102FunctionEnd 103 104Function GetOptions 105 106 Exch $1 107 Exch 108 Exch $0 109 Exch 110 Push $2 111 Push $3 112 Push $4 113 Push $5 114 Push $6 115 Push $7 116 117 StrCpy $2 $1 '' 1 118 StrCpy $1 $1 1 119 StrLen $3 $2 120 StrCpy $7 0 121 122 begin: 123 StrCpy $4 -1 124 StrCpy $6 '' 125 126 quote: 127 IntOp $4 $4 + 1 128 StrCpy $5 $0 1 $4 129 StrCmp $5$7 '0' notfound 130 StrCmp $5 '' trimright 131 StrCmp $5 '"' 0 +7 132 StrCmp $6 '' 0 +3 133 StrCpy $6 '"' 134 goto quote 135 StrCmp $6 '"' 0 +3 136 StrCpy $6 '' 137 goto quote 138 StrCmp $5 `'` 0 +7 139 StrCmp $6 `` 0 +3 140 StrCpy $6 `'` 141 goto quote 142 StrCmp $6 `'` 0 +3 143 StrCpy $6 `` 144 goto quote 145 StrCmp $5 '`' 0 +7 146 StrCmp $6 '' 0 +3 147 StrCpy $6 '`' 148 goto quote 149 StrCmp $6 '`' 0 +3 150 StrCpy $6 '' 151 goto quote 152 StrCmp $6 '"' quote 153 StrCmp $6 `'` quote 154 StrCmp $6 '`' quote 155 StrCmp $5 $1 0 quote 156 StrCmp $7 0 trimleft trimright 157 158 trimleft: 159 IntOp $4 $4 + 1 160 StrCpy $5 $0 $3 $4 161 StrCmp $5 '' notfound 162 StrCmp $5 $2 0 quote 163 IntOp $4 $4 + $3 164 StrCpy $0 $0 '' $4 165 StrCpy $4 $0 1 166 StrCmp $4 ' ' 0 +3 167 StrCpy $0 $0 '' 1 168 goto -3 169 StrCpy $7 1 170 goto begin 171 172 trimright: 173 StrCpy $0 $0 $4 174 StrCpy $4 $0 1 -1 175 StrCmp $4 ' ' 0 +3 176 StrCpy $0 $0 -1 177 goto -3 178 StrCpy $3 $0 1 179 StrCpy $4 $0 1 -1 180 StrCmp $3 $4 0 end 181 StrCmp $3 '"' +3 182 StrCmp $3 `'` +2 183 StrCmp $3 '`' 0 end 184 StrCpy $0 $0 -1 1 185 goto end 186 187 notfound: 188 StrCpy $0 '' 189 190 end: 191 Pop $7 192 Pop $6 193 Pop $5 194 Pop $4 195 Pop $3 196 Pop $2 197 Pop $1 198 Exch $0 199 200FunctionEnd 201 202; MUI Settings 203!define MUI_HEADERIMAGE 204!define MUI_HEADERIMAGE_RIGHT 205!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH 206!define MUI_HEADERIMAGE_BITMAP BANNERBMPPLACEHOLDER 207!define MUI_WELCOMEFINISHPAGE_BITMAP WELCOMEBMPPLACEHOLDER 208!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH 209!define MUI_WELCOMEPAGE_TITLE_3LINES 210!define MUI_ABORTWARNING 211!define MUI_ICON "SETUPICOPLACEHOLDER" 212 213; Welcome page 214!insertmacro MUI_PAGE_WELCOME 215!insertmacro MUI_PAGE_DIRECTORY 216!insertmacro MUI_PAGE_INSTFILES 217 218!macro MUI_LANGUAGE_PACK LANGUAGE 219 !verbose push 220 !verbose ${MUI_VERBOSE} 221 !insertmacro MUI_INSERT 222 LoadLanguageFile "NSISPATHPLACEHOLDER\${LANGUAGE}_pack.nlf" 223 ;Set default language file for MUI and backup user setting 224 !ifdef LANGFILE_DEFAULT 225 !define MUI_LANGFILE_DEFAULT_TEMP "${LANGFILE_DEFAULT}" 226 !undef LANGFILE_DEFAULT 227 !endif 228 !define LANGFILE_DEFAULT "${NSISDIR}\Contrib\Language files\English.nsh" 229 ;Include language file 230 !insertmacro LANGFILE_INCLUDE "NSISPATHPLACEHOLDER\${LANGUAGE}_pack.nsh" 231 ;Restore user setting for default language file 232 !undef LANGFILE_DEFAULT 233 !ifdef MUI_LANGFILE_DEFAULT_TEMP 234 !define LANGFILE_DEFAULT "${MUI_LANGFILE_DEFAULT}" 235 !endif 236 ;Add language to list of languages for selection dialog 237 !ifndef MUI_LANGDLL_LANGUAGES 238 !define MUI_LANGDLL_LANGUAGES "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' " 239 !define MUI_LANGDLL_LANGUAGES_CP "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' '${LANG_${LANGUAGE}_CP}' " 240 !else 241 !ifdef MUI_LANGDLL_LANGUAGES_TEMP 242 !undef MUI_LANGDLL_LANGUAGES_TEMP 243 !endif 244 !define MUI_LANGDLL_LANGUAGES_TEMP "${MUI_LANGDLL_LANGUAGES}" 245 !undef MUI_LANGDLL_LANGUAGES 246 !ifdef MUI_LANGDLL_LANGUAGES_CP_TEMP 247 !undef MUI_LANGDLL_LANGUAGES_CP_TEMP 248 !endif 249 !define MUI_LANGDLL_LANGUAGES_CP_TEMP "${MUI_LANGDLL_LANGUAGES_CP}" 250 !undef MUI_LANGDLL_LANGUAGES_CP 251 !define MUI_LANGDLL_LANGUAGES "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' ${MUI_LANGDLL_LANGUAGES_TEMP}" 252 !define MUI_LANGDLL_LANGUAGES_CP "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' '${LANG_${LANGUAGE}_CP}' ${MUI_LANGDLL_LANGUAGES_CP_TEMP}" 253 !endif 254 !verbose pop 255!macroend 256 257; Language files 258ALLLANGUAGESPLACEHOLDER 259 260; Reserve files 261;!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS 262 263; MUI end ------ 264 265Name "PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER" 266OutFile "OUTPUTDIRPLACEHOLDER\DOWNLOADNAMEPLACEHOLDER" 267; InstallDir "$DESKTOP\PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER Installation Files" 268; ShowInstDetails show 269 270Section "MainSection" SEC01 271ALLFILESPLACEHOLDER 272SectionEnd 273 274Section -Post 275 276 StrCpy $R9 "false" 277 278 Call GetParameters 279 Pop $1 280 281 Push $1 282 Push "/EXTRACTONLY=" 283 Call GetOptions 284 Pop $2 285 ;MessageBox MB_OK "EXTRACTONLY: $2" 286 287 StrCmp $2 "ON" onPostDone callsetup 288 callsetup: 289 290 Push $1 291 Push "/INSTALLLOCATION=" 292 Call GetOptions 293 Pop $2 294 ;MessageBox MB_OK "INSTALLLOCATION: $2" 295 296 StrCmp $2 "" installnotset installset 297 installset: 298 StrCpy $3 'INSTALLLOCATION="$2"' 299 installnotset: 300 301 Push $1 302 Push "/INSTALLJAVA=" 303 Call GetOptions 304 Pop $2 305 ;MessageBox MB_OK "INSTALLJAVA: $2" 306 307 StrCmp $2 "ON" setinstalljava setdontinstalljava 308 setinstalljava: 309 StrCpy $R9 "true" 310 setdontinstalljava: 311 312 Push $1 313 Push "/GUILEVEL=" 314 Call GetOptions 315 Pop $2 316 317 StrCmp $2 "" dontsetguilevel setguilevel 318 setguilevel: 319 StrCpy $7 "/" 320 StrCpy $7 $7$2 321 GoTo afterguilevel 322 dontsetguilevel: 323 StrCpy $7 "/qr" 324 afterguilevel: 325 326 ;MessageBox MB_OK "GUILEVEL: $7" 327 328 Push $1 329 Push "/PARAM1=" 330 Call GetOptions 331 Pop $2 332 ;MessageBox MB_OK "PARAM1: $2" 333 334 StrCmp $2 "" param1notset param1set 335 param1set: 336 StrCpy $4 "$2" 337 param1notset: 338 339 340 Push $1 341 Push "/PARAM2=" 342 Call GetOptions 343 Pop $2 344 ;MessageBox MB_OK "PARAM2: $2" 345 346 StrCmp $2 "" param2notset param2set 347 param2set: 348 StrCpy $5 "$2" 349 param2notset: 350 351 352 Push $1 353 Push "/PARAM3=" 354 Call GetOptions 355 Pop $2 356 ;MessageBox MB_OK "PARAM3: $2" 357 358 StrCmp $2 "" param3notset param3set 359 param3set: 360 StrCpy $6 "$2" 361 param3notset: 362 363 IfSilent onPostSilent onPostNoSilent 364 365 onPostSilent: 366 Push $1 367 Push "/POSTREMOVE=" 368 Call GetOptions 369 Pop $2 370 ;MessageBox MB_OK "POSTREMOVE: $2" 371 372 StrCmp $2 "ON" postremovesilent nopostremovesilent 373 nopostremovesilent: 374 StrCmp $R9 "true" installjava1 dontinstalljava1 375 installjava1: 376 ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qn REBOOT=Suppress"' 377 dontinstalljava1: 378 ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6 $7 -ignore_running" $0 379 SetErrorLevel $0 380 Quit 381 GoTo onPostDone 382 postremovesilent: 383 StrCmp $R9 "true" installjava2 dontinstalljava2 384 installjava2: 385 ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qn REBOOT=Suppress"' 386 dontinstalljava2: 387 ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6 $7 -ignore_running" $0 388 RMDir /r $INSTDIR 389 RMDir $INSTDIR 390 SetErrorLevel $0 391 Quit 392 GoTo onPostDone 393 394 onPostNoSilent: 395 Push $1 396 Push "/POSTREMOVE=" 397 Call GetOptions 398 Pop $2 399 ;MessageBox MB_OK "POSTREMOVE: $2" 400 401 StrCmp $2 "ON" postremove nopostremove 402 nopostremove: 403 Exec "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6" 404 Quit 405 GoTo onPostDone 406 postremove: 407 StrCmp $R9 "true" installjava3 dontinstalljava3 408 installjava3: 409 ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qr REBOOT=Suppress"' 410 dontinstalljava3: 411 ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6" $0 412 RMDir /r $INSTDIR 413 RMDir $INSTDIR 414 SetErrorLevel $0 415 Quit 416 GoTo onPostDone 417 418 onPostDone: 419 420SectionEnd 421