;--------------------------------------------------------------------------;
;--------------------------------------------------------------------------;
;------------ Written By MichaelFlya for the Winamp NSIS Forum ------------;
;                                                                          ;
; Example for Learning How to Take a Section away from the Component Page  ;
; of the Uninstaller if that Section wasn't Installed in the Installers    ;
; Component Page.                                                          ;
;                                                                          ;
;--------------------------------------------------------------------------;
;--------------------------------------------------------------------------;
;                                                                          ;
; This Is only Half of what it Takes the other half Is needed. Read the    ;
; the Bottom to Understand more of what is of my Understanding             ;
;                                                                          ;
;--------------------------------------------------------------------------;
;--------------------------------------------------------------------------;


;--------------------------------
;--------------------------------
; Includes
;--------------------------------

  !include "MUI.nsh"
  !include "Sections.nsh"

;--------------------------------
;--------------------------------
; Names (General)
;--------------------------------

Name "Test_Installer"
OutFile "Test_Installer.exe"
InstallDir $Desktop\Test_Installer

#!define MUI_ICON ".\ICONS\ICON.ico"
#!define MUI_UNICON ".\ICONS\UNICON.ico"



;--------------------------------
;--------------------------------
; Pages
;--------------------------------



  !insertmacro MUI_PAGE_COMPONENTS
  !insertmacro MUI_PAGE_INSTFILES


  !insertmacro MUI_UNPAGE_COMPONENTS
  !insertmacro MUI_UNPAGE_INSTFILES

  !insertmacro MUI_LANGUAGE "English"



;--------------------------------
;--------------------------------
; Variables
;--------------------------------






;--------------------------------
;--------------------------------
; Functions to Call
;--------------------------------






;--------------------------------
;--------------------------------
; Installer Pages
;--------------------------------


Section "Install Readme 01" Section1
  SetOutPath "$INSTDIR"
File .\Readme_01.txt
SectionEnd

Section "Install Readme 02" Section2
  SetOutPath "$INSTDIR"
File .\Readme_02.txt
SectionEnd

Section "-Create_UnInstaller"
     CreateDirectory $INSTDIR
     WriteUninstaller "$INSTDIR\Uninstaller.exe"
     CreateShortCut "$Desktop\Uninstaller.lnk" "$INSTDIR\Uninstaller.exe"
SectionEnd





;--------------------------------
;--------------------------------
; UnInstaller Pages
;--------------------------------

Section "Un.UnInstall Readme 01" Section3
Delete "$INSTDIR\Readme_01.txt"
SectionEnd

Section "Un.UnInstall Readme 02" Section4
Delete "$INSTDIR\Readme_02.txt"
SectionEnd


Section "-Un.Remove_What_is_Left"
     Delete "$Desktop\Uninstaller.lnk"
     Delete "$INSTDIR\Uninstaller.exe"
     RMDir "$INSTDIR"
SectionEnd

;--------------------------------
;--------------------------------
;  RMDir "$INSTDIR" Will Only 
;  Happen if Both Files are
;  Uninstalled.
;--------------------------------
;--------------------------------


;--------------------------------
;--------------------------------
; (Installer/Uninstaller)
; Component Descriptions
;--------------------------------

  ;Language strings



  LangString DESC_SecDummy1 ${LANG_ENGLISH} "This Will Install Readme 1"
  LangString DESC_SecDummy2 ${LANG_ENGLISH} "This Will Install Readme 2"

  LangString DESC_SecDummy3 ${LANG_ENGLISH} "This Will UnInstall Readme 1"
  LangString DESC_SecDummy4 ${LANG_ENGLISH} "This Will UnInstall Readme 2"

  ;Assign language strings to sections
  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${SECTION1} $(DESC_SecDummy1)
    !insertmacro MUI_DESCRIPTION_TEXT ${SECTION2} $(DESC_SecDummy2)

  !insertmacro MUI_FUNCTION_DESCRIPTION_END

  !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${SECTION3} $(DESC_SecDummy3)
    !insertmacro MUI_DESCRIPTION_TEXT ${SECTION4} $(DESC_SecDummy4)

  !insertmacro MUI_UNFUNCTION_DESCRIPTION_END






;---------------------------------------------------------------------------;
;---------------------------------------------------------------------------;
;-------- NOW HERE IS THE QUESTION. PLEASE ANSWER USING THIS SCRIPT --------;
;---------------------------------------------------------------------------;
;---------------------------------------------------------------------------;
; I left off The Un.onInit for Someone to Help Me Understand Section Flags  ;
; So That Section that is needed to Fully get this to Work would need to be ;
; Written by Somebody Who knows. Adding Code to what is Needed and Posting  ;
; back on the Winamp.com NSIS Forum Where you Found this File. So to start  ;
; For the Purpose of Telling me how to Do what I Wanted to Understand Using ;
; These Section Names Please Show me How to do What I am Trying to do.      ;
;                                                                           ;
; Section1                                                                  ;
; Section2                                                                  ;
; Section3                                                                  ;
; Section4                                                                  ;
;                                                                           ;
; Using IfFileExists Could I Request if Whether or not Readme_01.txt or     ;
; Readme_02.txt Is there... If one is not than the UnInstaller Will Remove  ;
; That Section. So if Only Readme_01.txt Is Found it will Not Show Section4 ;
; on the Uninstallers List. That is about it... I have no idea how to Go    ;
; about it to where this Can be Achieved.. Even if to Go about it in a      ;
; Different way.                                                            ;
;---------------------------------------------------------------------------;
;---------------------------------------------------------------------------;














