Archive: nsDialogs::SelectFolderDialog


nsDialogs::SelectFolderDialog
Hi,

I have used following function nsDialogs::SelectFolderDialog but it does not show the dialogbox. Any idea?

This is the script

!include LogicLib.nsh

;Installer Created By Sujith Quintelier
;This Script Intend To Install 3 Components
; - Install JRE 1.5.12 (jre)
; - Install Tomcat Application Server 6.0.13 (tomcat)
; - Install TINKsearch
; -- Copy Data (data)
; -- Copy Application (app)
; -- Copy Users (users)
; - Install Tinksearch Config (config)
;--------------------------------
; The name of the installer
Name "TINKsearch"

; The file to write
OutFile "TINKsearch.exe"

; The default installation directory
InstallDir $PROGRAMFILES\ICMS\TINKsearch

; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\ICMS\TINKsearch" "Install_Dir"

;--------------------------------
; Variables

Var TS_DATA_DIR
Var TS_APP_DIR

;--------------------------------
; InstTypes
!ifndef NOINSTTYPES ; only if not defined
InstType "Full"
InstType "JRE"
InstType "Tomcat"
InstType "TINKsearch"
InstType "TINKsearchConfig"
;InstType /NOCUSTOM
;InstType /COMPONENTSONLYONCUSTOM
!endif


;--------------------------------
; Pages

Page components
Page directory
Page custom selectDataFolder
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles

; selectDataFolder: Show Select Folder Dialog When Data Must Be Copied
Function selectDataFolder
; Check If Data Has Been Selected
SectionGetFlags 3 $0
IntOp $0 $0 & ${SF_SELECTED}
; Do Check Data Has Been Selected
${If} $0 == 1
; Show Select Folder Dialog
nsDialogs::SelectFolderDialog
Pop $TS_DATA_DIR
; Check A Folder Has Been Selected
${If} $TS_DATA_DIR == "error"
MessageBox MB_OK "Must Choose Folder!"
; Cancel Installation
Abort
${EndIf}
${EndIf}
FunctionEnd

;--------------------------------
; The stuff to install
; Install JRE
; Index=0
Section /o "Install JRE" jre
SectionIn 1 2
SetOutPath $INSTDIR\temp
File "JRE\jre.exe"
ExecWait "$INSTDIR\temp\jre.exe"
RMDir /r "$INSTDIR\temp"
SectionEnd

; Install Apache Foundata Sofware Tomcat Application Server
; Index=1
Section /o "Install Tomcat Application Server" tomcat
SectionIn 1 3
SetOutPath $INSTDIR\temp
File "AppServer\apache-tomcat.exe"
ExecWait "$INSTDIR\temp\apache-tomcat.exe"
RMDir /r "$INSTDIR\temp"
SectionEnd

; Install TINKsearch Group
SectionGroup TINKsearch
; Copy Data Structure
; Index=2
Section /o "Copy Data Structure" data
SectionIn 1 4
SetOutPath $TS_DATA_DIR
File /r "Data\TINKsearch"
SectionEnd

; Copy TINKsearch Application
; Index=3
Section /o "Copy TINKsearch Application" app
SectionIn 1 4
; Check if the service exists
SimpleSC::ExistsService "tomcat6"
; return service exists(1)/service doesn´t exists (0)
Pop $0
${If} $0 == 1
; Check if the service is stopped
SimpleSC::ServiceIsStopped "tomcat6"
; return $0 error(1)/success(0), $1 Stopped(1)/Not Stopped(0)
Pop $0
Pop $1
${If} $0 == 0
ReadRegStr $TS_APP_DIR HKLM "Software\Apache Software Foundation\Tomcat\6.0" InstallPath
${If} $1 == 0
; Stop a service
SimpleSC::StopService "tomcat6"
; return error(1)/success(0)
Pop $0
${If} $0 == 0
SetOutPath "$TS_APP_DIR\webapps"
File /r "webapps\TINKsearch"
${Else}
SetOutPath "$INSTDIR\temp"
File /r "webapps\TINKsearch"
MessageBox MB_OK 'tomcat6 Service Could Not Be Stopped: Please Copy $INSTDIR\temp\TINKsearch to $TS_APP_DIR\webapps'
${EndIf}
${Else}
SetOutPath "$TS_APP_DIR\webapps"
File /r "webapps\TINKsearch"
${EndIf}
${EndIf}
${Else}
MessageBox MB_OK 'No Tomcat Has Not Been Installed'
${EndIf}

SectionEnd

; Copy Tomcat-Users.xml
; Index=4
Section /o "Copy Tomcat-Users" users
SectionIn 1 4
; Check if the service exists
SimpleSC::ExistsService "tomcat6"
; return service exists(1)/service doesn´t exists (0)
Pop $0
${If} $0 == 1
; Check if the service is stopped
SimpleSC::ServiceIsStopped "tomcat6"
; return $0 error(1)/success(0), $1 Stopped(1)/Not Stopped(0)
Pop $0
Pop $1
${If} $0 == 0
ReadRegStr $TS_APP_DIR HKLM "Software\Apache Software Foundation\Tomcat\6.0" InstallPath
${If} $1 == 0
; Stop a service
SimpleSC::StopService "tomcat6"
; return error(1)/success(0)
Pop $0
${If} $0 == 0
SetOutPath "$TS_APP_DIR\conf"
File /r "conf\tomcat-users.xml"
${Else}
SetOutPath "$INSTDIR\temp"
File /r "conf\tomcat-users.xml"
MessageBox MB_OK 'tomcat6 Service Could Not Be Stopped: Please Copy $INSTDIR\temp\tomcat-users.xml to $TS_APP_DIR\conf'
${EndIf}
${Else}
SetOutPath "$TS_APP_DIR\conf"
File /r "conf\tomcat-users.xml"
${EndIf}
${EndIf}
${Else}
MessageBox MB_OK 'No Tomcat Has Not Been Installed'
${EndIf}

SectionEnd
SectionGroupEnd

; Install TINKsearch Config
; Index=5
Section /o "Install TINKsearch Config" config
SectionIn 1 5
SetOutPath $INSTDIR\temp
File /r "TINKsearchConfig"
ExecWait "$INSTDIR\temp\TINKsearchConfig\setup.exe"
RMDir /r "$INSTDIR\temp"

; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\ICMS\TINKsearch "Install_Dir" "$INSTDIR"

; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TINKsearch" "DisplayName" "TINKsearch"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TINKsearch" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TINKsearch" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TINKsearch" "NoRepair" 1

; Write Data Path into the registry
WriteRegStr HKLM "Software\ICMS\TINKsearch" "DataDir" $TS_DATA_DIR

; Write Uninstaller
WriteUninstaller "uninstall.exe"

; Create Short Cut For The Uninstaller
CreateDirectory "$SMPROGRAMS\ICMS\TINKsearch"
CreateShortCut "$SMPROGRAMS\ICMS\TINKsearch\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0

SectionEnd

;--------------------------------
; Uninstaller
; Index=6
Section "Uninstall"
; Remove files and uninstaller
Delete $INSTDIR\uninstall.exe
Delete $INSTDIR\temp\*.*
Delete $TS_APP_DIR\webapps\TINKsearch\*.*

; Remove shortcuts, if any
Delete "$SMPROGRAMS\ICMS\TINKsearch\*.*"

; Remove directories used
RMDir /r "$SMPROGRAMS\ICMS\TINKsearch"
RMDir /r "$INSTDIR"

; Read registry settings
;ReadRegStr $TS_DATA_DIR HKLM Software\ICMS\TINKsearch DataDir
ReadRegStr $TS_APP_DIR HKLM Software\ICMS\TINKsearch AppDir

; Remove TINKsearch Data (Currently Disabled)
;RMDir /r $TS_DATA_DIR

; Remove TINKsearch Application
RMDir /r $TS_APP_DIR\webapps\TINKsearch

; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TINKsearch"
DeleteRegKey HKLM SOFTWARE\ICMS\TINKsearch

SectionEnd


Thx,
Sujith


you still need to provide the two params:

nsDialogs::SelectFolderDialog "" ""

you might aswell supply some decent defaults,

nsDialogs::SelectFolderDialog "Select the folder to configure..." "$programfiles\foo\config"

edit: please attach the script next time