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