test.nsi 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ;InstallOptions Test Script
  2. ;Written by Joost Verburg
  3. ;--------------------------
  4. !define TEMP1 $R0 ;Temp variable
  5. ;The name of the installer
  6. Name "InstallOptions Test"
  7. ;The file to write
  8. OutFile "Test.exe"
  9. ; Show install details
  10. ShowInstDetails show
  11. ;Things that need to be extracted on startup (keep these lines before any File command!)
  12. ;Only useful for BZIP2 compression
  13. ;Use ReserveFile for your own InstallOptions INI files too!
  14. ReserveFile /plugin InstallOptions.dll
  15. ReserveFile "test.ini"
  16. ;Order of pages
  17. Page custom SetCustom ValidateCustom ": Testing InstallOptions" ;Custom page. InstallOptions gets called in SetCustom.
  18. Page instfiles
  19. Section "Components"
  20. ;Get Install Options dialog user input
  21. ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 2" "State"
  22. DetailPrint "Install X=${TEMP1}"
  23. ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 3" "State"
  24. DetailPrint "Install Y=${TEMP1}"
  25. ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 4" "State"
  26. DetailPrint "Install Z=${TEMP1}"
  27. ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 5" "State"
  28. DetailPrint "File=${TEMP1}"
  29. ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 6" "State"
  30. DetailPrint "Dir=${TEMP1}"
  31. ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 8" "State"
  32. DetailPrint "Info=${TEMP1}"
  33. SectionEnd
  34. Function .onInit
  35. ;Extract InstallOptions files
  36. ;$PLUGINSDIR will automatically be removed when the installer closes
  37. InitPluginsDir
  38. File /oname=$PLUGINSDIR\test.ini "test.ini"
  39. FunctionEnd
  40. Function SetCustom
  41. ;Display the InstallOptions dialog
  42. Push ${TEMP1}
  43. InstallOptions::dialog "$PLUGINSDIR\test.ini"
  44. Pop ${TEMP1}
  45. Pop ${TEMP1}
  46. FunctionEnd
  47. Function ValidateCustom
  48. ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 2" "State"
  49. StrCmp ${TEMP1} 1 done
  50. ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 3" "State"
  51. StrCmp ${TEMP1} 1 done
  52. ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 4" "State"
  53. StrCmp ${TEMP1} 1 done
  54. MessageBox MB_ICONEXCLAMATION|MB_OK "You must select at least one install option!"
  55. Abort
  56. done:
  57. FunctionEnd