Examples/ExperienceUI/InstallOptions.nsi
changeset 0 d5ce4c64ef88
child 13 2ae1abe546fd
equal deleted inserted replaced
-1:000000000000 0:d5ce4c64ef88
       
     1 ;ExperienceUI for NSIS
       
     2 ;Header Bitmap Example Script
       
     3 ;Written by Dan Fuhry
       
     4 
       
     5 ;OK, I cheated, Joost wrote it :)
       
     6 
       
     7 ;---------------------
       
     8 ;Include ExperienceUI
       
     9 
       
    10   !include "XPUI.nsh"
       
    11 
       
    12 ;--------------------------------
       
    13 ;General
       
    14 
       
    15   ;Name and file
       
    16   Name "ExperienceUI Test 1.1"
       
    17   OutFile "InstallOptions.exe"
       
    18 
       
    19   ;Default installation folder
       
    20   InstallDir "$PROGRAMFILES\ExperienceUI Test"
       
    21   
       
    22   ;Get installation folder from registry if available
       
    23   InstallDirRegKey HKCU "Software\ExperienceUI Test" ""
       
    24 
       
    25 ;--------------------------------
       
    26 ;Interface Settings
       
    27 
       
    28   !define XPUI_ABORTWARNING
       
    29 
       
    30 ;--------------------------------
       
    31 ;Pages
       
    32 
       
    33   !insertmacro XPUI_PAGE_LICENSE "${NSISDIR}\Docs\ExperienceUI\Index.htm"
       
    34   Page custom CustomPageA
       
    35   !insertmacro XPUI_PAGE_COMPONENTS
       
    36   Page custom CustomPageB
       
    37   !insertmacro XPUI_PAGE_DIRECTORY
       
    38   Page custom CustomPageC
       
    39   !insertmacro XPUI_PAGE_INSTFILES
       
    40   
       
    41   !insertmacro XPUI_PAGEMODE_UNINST
       
    42   !insertmacro XPUI_PAGE_UNINSTCONFIRM_NSIS
       
    43   !insertmacro XPUI_PAGE_INSTFILES
       
    44   
       
    45 ;--------------------------------
       
    46 ;Languages
       
    47  
       
    48   !insertmacro XPUI_LANGUAGE "English"
       
    49 
       
    50 ;--------------------------------
       
    51 ;Reserve Files
       
    52   
       
    53   ;These files should be inserted before other files in the data block
       
    54   ;Keep these lines before any File command
       
    55   ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
       
    56   
       
    57   ReserveFile "ioA.ini"
       
    58   ReserveFile "ioB.ini"
       
    59   ReserveFile "ioC.ini"
       
    60   !insertmacro XPUI_RESERVEFILE_INSTALLOPTIONS
       
    61 
       
    62 ;--------------------------------
       
    63 ;Variables
       
    64 
       
    65   Var INI_VALUE
       
    66 
       
    67 ;--------------------------------
       
    68 ;Installer Sections
       
    69 
       
    70 Section "Dummy Section" SecDummy
       
    71 
       
    72   SetOutPath "$INSTDIR"
       
    73   
       
    74   ;ADD YOUR OWN FILES HERE...
       
    75   
       
    76   ;Store installation folder
       
    77   WriteRegStr HKCU "Software\ExperienceUI Test" "" $INSTDIR
       
    78   
       
    79   ;Create uninstaller
       
    80   WriteUninstaller "$INSTDIR\Uninstall.exe"
       
    81   
       
    82   ;Read a value from an InstallOptions INI file
       
    83   !insertmacro XPUI_INSTALLOPTIONS_READ $INI_VALUE "ioC.ini" "Field 2" "State"
       
    84   
       
    85   ;Display a messagebox if check box was checked
       
    86   StrCmp $INI_VALUE "1" "" +2
       
    87     MessageBox MB_OK "You checked the check box, here is the MessageBox..."
       
    88 
       
    89 SectionEnd
       
    90 
       
    91 ;--------------------------------
       
    92 ;Installer Functions
       
    93 
       
    94 !insertmacro XPUI_PAGEMODE_INST
       
    95 
       
    96 Function .onInit
       
    97 
       
    98   ;Extract InstallOptions INI files
       
    99   !insertmacro XPUI_INSTALLOPTIONS_EXTRACT "ioA.ini"
       
   100   !insertmacro XPUI_INSTALLOPTIONS_EXTRACT "ioB.ini"
       
   101   !insertmacro XPUI_INSTALLOPTIONS_EXTRACT "ioC.ini"
       
   102   
       
   103 FunctionEnd
       
   104 
       
   105 LangString TEXT_IO_TITLE ${LANG_ENGLISH} "InstallOptions page"
       
   106 LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "This is a page created using the InstallOptions plug-in."
       
   107 
       
   108 Function CustomPageA
       
   109 
       
   110   !insertmacro XPUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
       
   111   !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "ioA.ini"
       
   112 
       
   113 FunctionEnd
       
   114 
       
   115 Function CustomPageB
       
   116 
       
   117   !insertmacro XPUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
       
   118   !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "ioB.ini"
       
   119 
       
   120 FunctionEnd
       
   121 
       
   122 Function CustomPageC
       
   123 
       
   124   !insertmacro XPUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
       
   125   !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "ioC.ini"
       
   126 
       
   127 FunctionEnd
       
   128 
       
   129 ;--------------------------------
       
   130 ;Descriptions
       
   131 
       
   132   ;Language strings
       
   133   LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
       
   134 
       
   135   ;Assign language strings to sections
       
   136   !insertmacro XPUI_FUNCTION_DESCRIPTION_BEGIN
       
   137     !insertmacro XPUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
       
   138   !insertmacro XPUI_FUNCTION_DESCRIPTION_END
       
   139 
       
   140 ;--------------------------------
       
   141 ;Uninstaller Section
       
   142 
       
   143 Section "Uninstall"
       
   144 
       
   145   ;ADD YOUR OWN FILES HERE...
       
   146 
       
   147   Delete "$INSTDIR\Uninstall.exe"
       
   148 
       
   149   RMDir "$INSTDIR"
       
   150 
       
   151   DeleteRegKey /ifempty HKCU "Software\ExperienceUI Test"
       
   152 
       
   153 SectionEnd