home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 March / CMCD0304.ISO / Software / Freeware / Programare / nullsoft / nsis20.exe / Contrib / InstallOptions / test.nsi < prev    next >
Text File  |  2003-06-10  |  2KB  |  85 lines

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