Examples/ExperienceUI/StartMenu.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 !define XPUI_WANSIS
       
     8 
       
     9 ;--------------------------------
       
    10 ;Include ExperienceUI
       
    11 
       
    12   !include "XPUI.nsh"
       
    13 
       
    14 ;--------------------------------
       
    15 ;General
       
    16 
       
    17   ;Name and file
       
    18   Name "ExperienceUI Test"
       
    19   OutFile "StartMenu.exe"
       
    20 
       
    21   ;Default installation folder
       
    22   InstallDir "$PROGRAMFILES\ExperienceUI Test"
       
    23   
       
    24   ;Get installation folder from registry if available
       
    25   InstallDirRegKey HKCU "Software\ExperienceUI Test" ""
       
    26 
       
    27 ;--------------------------------
       
    28 ;Variables
       
    29 
       
    30   Var XPUI_TEMP
       
    31   Var STARTMENU_FOLDER
       
    32 
       
    33 ;--------------------------------
       
    34 ;Interface Settings
       
    35 
       
    36   !define XPUI_ABORTWARNING
       
    37 
       
    38 ;--------------------------------
       
    39 ;Pages
       
    40 
       
    41   !insertmacro XPUI_PAGE_LICENSE "${NSISDIR}\Contrib\ExperienceUI\License.rtf"
       
    42   !insertmacro XPUI_PAGE_COMPONENTS
       
    43   !insertmacro XPUI_PAGE_DIRECTORY
       
    44   
       
    45   ;Start Menu Folder Page Configuration
       
    46   !define XPUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
       
    47   !define XPUI_STARTMENUPAGE_REGISTRY_KEY "Software\ExperienceUI Test"
       
    48   !define XPUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
       
    49   
       
    50   !insertmacro XPUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
       
    51   
       
    52   !insertmacro XPUI_PAGE_INSTFILES
       
    53   !insertmacro XPUI_PAGE_FINISH
       
    54   !insertmacro XPUI_PAGE_ABORT
       
    55   
       
    56   !insertmacro XPUI_PAGEMODE_UNINST
       
    57   !insertmacro XPUI_PAGE_UNINSTCONFIRM_NSIS
       
    58   !insertmacro XPUI_PAGE_INSTFILES
       
    59 
       
    60 ;--------------------------------
       
    61 ;Languages
       
    62  
       
    63   !insertmacro XPUI_LANGUAGE "English"
       
    64 
       
    65 ;--------------------------------
       
    66 ;Installer Sections
       
    67 
       
    68 Section "Dummy Section" SecDummy
       
    69 
       
    70   SetOutPath "$INSTDIR"
       
    71   
       
    72   ;ADD YOUR OWN FILES HERE...
       
    73   
       
    74   ;Store installation folder
       
    75   WriteRegStr HKCU "Software\ExperienceUI Test" "" $INSTDIR
       
    76   
       
    77   ;Create uninstaller
       
    78   WriteUninstaller "$INSTDIR\Uninstall.exe"
       
    79   
       
    80   !insertmacro XPUI_STARTMENU_WRITE_BEGIN Application
       
    81     
       
    82     ;Create shortcuts
       
    83     CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
       
    84     CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
       
    85   
       
    86   !insertmacro XPUI_STARTMENU_WRITE_END
       
    87 
       
    88 SectionEnd
       
    89 
       
    90 ;--------------------------------
       
    91 ;Descriptions
       
    92 
       
    93   ;Language strings
       
    94   LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
       
    95 
       
    96   ;Assign language strings to sections
       
    97   !insertmacro XPUI_FUNCTION_DESCRIPTION_BEGIN
       
    98     !insertmacro XPUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
       
    99   !insertmacro XPUI_FUNCTION_DESCRIPTION_END
       
   100  
       
   101 ;--------------------------------
       
   102 ;Uninstaller Section
       
   103 
       
   104 Section "Uninstall"
       
   105 
       
   106   ;ADD YOUR OWN FILES HERE...
       
   107 
       
   108   Delete "$INSTDIR\Uninstall.exe"
       
   109 
       
   110   RMDir "$INSTDIR"
       
   111   
       
   112   !insertmacro XPUI_STARTMENU_GETFOLDER Application $XPUI_TEMP
       
   113     
       
   114   Delete "$SMPROGRAMS\$XPUI_TEMP\Uninstall.lnk"
       
   115   
       
   116   ;Delete empty start menu parent diretories
       
   117   StrCpy $XPUI_TEMP "$SMPROGRAMS\$XPUI_TEMP"
       
   118  
       
   119   startMenuDeleteLoop:
       
   120 	ClearErrors
       
   121     RMDir $XPUI_TEMP
       
   122     GetFullPathName $XPUI_TEMP "$XPUI_TEMP\.."
       
   123     
       
   124     IfErrors startMenuDeleteLoopDone
       
   125   
       
   126     StrCmp $XPUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
       
   127   startMenuDeleteLoopDone:
       
   128 
       
   129   DeleteRegKey /ifempty HKCU "Software\ExperienceUI Test"
       
   130 
       
   131 SectionEnd