Archive: Directory page help!


Directory page help!
Hi,

I need to create an installer that show a defined path from the registry, but if that path is incorrect the user needs to be able to point to the correct install path.

As far as i know the MUI_DIRECTORYPAGE_VARIABLE is the one that i should use to get the path from the registry but as it is i can't get it to work, any help?

;Directory Page
!define MUI_DIRECTORYPAGE_TEXT_TOP "Opus Neo Installer"
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "The default install location"
!define MUI_DIRECTORYPAGE_VARIABLE ReadRegStr $0 HKLM "SOFTWARE\Lotus\Domino\1" "DataPath"
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE


MUI_DIRECTORYPAGE_VARIABLE is only used to define a variable name other than $INSTDIR.

You can use it like this:

Var $folder
!define MUI_DIRECTORYPAGE_VARIABLE $folder
function .onInit
ReadRegStr $folder HKLM "SOFTWARE\Lotus\Domino\1" "DataPath"
functionend


Why not just use InstallDirRegKey?

Stu


From what I understand, he/she wants the user to confirm the path before it's used.


Originally posted by MSG
MUI_DIRECTORYPAGE_VARIABLE is only used to define a variable name other than $INSTDIR.

You can use it like this:

Var $folder
!define MUI_DIRECTORYPAGE_VARIABLE $folder
function .onInit
ReadRegStr $folder HKLM "SOFTWARE\Lotus\Domino\1" "DataPath"
functionend
MSG thanks that work perfect i just had to change it just a bit at the "Var $folder" to this:
Var folder(Without the $)

So know i get my installer that pulls the path from the registry, and if there is no path in the registry the users can Browse after the right one. Is there anyway to disable the "Install" button if the directory path is empty?

You can probably use .onVerifyInstDir .
http://nsis.sourceforge.net/Docs/Cha...html#4.7.2.1.2

Or just throw a messagebox error with abort in the page's LEAVE function.


Okay if i remove the !define MUI_DIRECTORYPAGE_VERIFYONLEAVE i can't install unless there is a path.

But as i now works with the code i got from MSG something is wrong in my script. I get an error if i try and install it in a directory when i use the browse button this is after i used the directory page.

Can you find anything there could cause this problem?

#neodashboard
!include MUI2.nsh
!include nsDialogs.nsh
!include LogicLib.nsh

outFile "Neo.Dashboard 4.3 Directory_Test Setup.exe"

Name "Neo.Dashboard 4.3"

;General Page settings
!define MUI_PAGE_HEADER_TEXT "License Agreement"
!define MUI_PAGE_HEADER_SUBTEXT "Please review the terms before installing Neo.Dashboard 4.3"



;Headerimage
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "Installer150x57.bmp"
!define MUI_ABORTWARNING


;License Page
#!define MUI_LICENSEPAGE_TEXT_TOP "Please review the license terms below before installing Neo.Dashboard 4.3"
!define MUI_LICENSEPAGE_CHECKBOX
#!define MUI_LICENSEPAGE_CHECKBOX_TEXT "Check here if you agree with the terms"


;Finish Page
!define MUI_FINISHPAGE_TITLE "Installation Completed"
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TEXT "Neo.Dashboard 4.3 has been installed successfully$\r$\nClick Finish to exit the wizard."
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_CANCEL_ENABLED
!define MUI_FINISHPAGE_BUTTON "Finish"
!define MUI_FINISHPAGE_SHOWREADME "https://qen.workplace.dk/LotusQuickr/neodoc/Main.nsf/h_Toc/1d2f160d62a78c9cc1257745002a1bad/?OpenDocument"
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Check this box if you want to open the documentation"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_LINK "www.opusneo.com"
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.opusneo.com"
!define MUI_FINISHPAGE_LINK_COLOR "E56E1F"


;Welcome Page
!define MUI_WELCOMEPAGE_TITLE "Welcome to the installation wizard for Neo.Dashboard 4.3"
!define MUI_WELCOMEPAGE_3LINES
!define MUI_WELCOMEPAGE_TEXT "The installation wizard will unpack all the necessary files for Neo.Dashboard 4.3 on your server. To continue, click Next$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\nWARNING: This program is protected by copyright law and international treaties"
!define MUI_WELCOMEFINISHPAGE_BITMAP "Installer164x314.bmp"
#!define MUI_BGCOLOR "000000"
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH

;Installation Page
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "The installation of neodashboard has been completed"
#!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "OPUSNEO"
!define MUI_INSTFILESPAGE_ABORTHEADER_TEXT "THE INSTALLATION HAVE BEEN ABORTED"
!define MUI_INSTFILESPAGE_ABORTHEADER_SUBTEXT "Please contact Opus neo support"
#!define MUI_INSTFILESPAGE_COLORS "E56E1F 000000"
!define MUI_INSTFILESPAGE_COLORS "FFFFFF FF8407"
#!define MUI_INSTFILESPAGE_PROGRESSBAR "colored"
!define MUI_INSTALLCOLORS "E56E1F"

;Directory Page
!define MUI_DIRECTORYPAGE_TEXT_TOP "Neo.Dashbord 4.3 installer:$\r$\n$\rBy default the installation path is taken from the registry database$\r$\n$\rIf the destination is empty, you can select the destination by clicking on Browse and select your Domino data folder. In example C:\IBM\Lotus\Domino\data"
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Destination:"
;!define MUI_DIRECTORYPAGE_VERIFYONLEAVE


Var folder
!define MUI_DIRECTORYPAGE_VARIABLE $folder
function .onInit
ReadRegStr $folder HKLM "SOFTWARE\Lotus\Domino\1" "DataPath"
functionend


!define MUI_ICON "neodashboard.ico"


;Interface Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "Program License Agreement.rtf"
!insertmacro MUI_PAGE_DIRECTORY
;Page custom InstallDirectory
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH


!insertmacro MUI_LANGUAGE "English"



section "html"

ReadRegStr $0 HKLM "SOFTWARE\Lotus\Domino\1" "DataPath"

setOutPath $0\domino\html

file /r opusneo_html\*.*

sectionEnd

section "data"

ReadRegStr $0 HKLM "SOFTWARE\Lotus\Domino\1" "DataPath"

setOutPath $0

file /r opusneo_data\*.*

sectionEnd

section "ntf"

ReadRegStr $0 HKLM "SOFTWARE\Lotus\Domino\1" "DataPath"

setOutPath $0

file /r opusneo_ntf\*.*


sectionEnd


In the sections you're not using the path the user entered. You're once again trying to read it from registry.

(Also note that if you have no normal directory page, you don't need to use a separate variable for it. You can simply use the default $INSTDIR variable.)

Oh, and please don't paste large amounts of code. Use an attachment or pastebin.


Originally posted by MSG
From what I understand, he/she wants the user to confirm the path before it's used.
InstallDirRegKey is exactly the same as using ReadRegStr in .onInit so I don't understand why you don't just use that along with a directory page. Also why use MUI_DIRECTORYPAGE_VARIABLE? Why not just use $INSTDIR?

Stu

Yeah, I was under the mistaken impression he needed a second directory page.


Okay thanks guys that work perfect!

Thanks for the help!