; example1.nsi
;--------------------------------

; The name of the installer
Name "Example1"

; The file to write
OutFile "example1.exe"

; The default installation directory
InstallDir $DESKTOP\Example1

; Request application privileges for Windows Vista
RequestExecutionLevel user

;--------------------------------

!include MUI2.nsh
!include nsDialogs.nsh

; Pages

!insertmacro MUI_PAGE_WELCOME
Page custom PagePaths PagePathsLeave
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"
;--------------------------------

Function PagePaths

  Var /global Program1_Location
  Var /global Program1_Location_State
  Var /global Program1_Button

  nsDialogs::Create /NOUNLOAD 1018
  Pop $0

  !insertmacro MUI_HEADER_TEXT "Select 64-bit directories" "Some thing else here"
  ${NSD_CreateLabel} 0 5u 35u 9u "Program 1:"
  ${NSD_CreateText} 45u 3u 225u 12u ""
  Pop $Program1_Location
  ${NSD_CreateButton} 275u 2u 14u 14u "..."
  Pop $Program1_Button

  ${NSD_OnClick} $Program1_Button GetProg1Path

  nsDialogs::Show

FunctionEnd

Function PagePathsLeave

  ${NSD_GetText} $Program1_Location $Program1_Location_State

FunctionEnd

Function GetProg1Path

  nsDialogs::SelectFolderDialog "Browse for Prog 1 Location" $PROGRAMFILES64
  Pop $R0

  ${NSD_SetText} $Program1_Location $R0

FunctionEnd

; The stuff to install
Section ""

  DetailPrint "$Program1_Location_State"
  
SectionEnd ; end the section
