Hi,
first of all, please excuse my approximative English (Foreign Languages have never been a famous strength of french people ^^)
I'm using NSIS & MUI to install several software, and I need :
- to extract data in a temporary folder
- then, to perform the install in a different folder
So, here's the code I try to use :
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY ; choose the directory for extraction
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY ; choose the directory for installation
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
$INSTDIR is initialized in Function .onInit with the default extraction dir value (let's say C:\Temp) : when the first Directory page appears, C:\Temp is in the textfield. What I'd like to do is to change it after that, so that in the second Directory page, the installation dir (let's say C:\Install) is in the textfield.
I tried to change $INSTDIR between the two Directories pages, unsuccessfully. The directory remains the same (C:\Temp).
Any ideas ?
Two install dirs ?
7 posts
Hello magicpm7,
It seems to me you can't use two directory pages in the same installer !!!
Use one directory page (the directory will be stocked in $INSTDIR)
Simulate the second in a custom page using for example nsDialog plugin or InstallOption plugin (the directory will be stocked in a global variable that you will create).
In your sections, you will be able to switch between the two directories thanks to the SetOutPath function.
[edit]
Look at the next post, there are a better solution with two directory pages.
[/edit]
It seems to me you can't use two directory pages in the same installer !!!
Use one directory page (the directory will be stocked in $INSTDIR)
Simulate the second in a custom page using for example nsDialog plugin or InstallOption plugin (the directory will be stocked in a global variable that you will create).
In your sections, you will be able to switch between the two directories thanks to the SetOutPath function.
[edit]
Look at the next post, there are a better solution with two directory pages.
[/edit]
You can use two directory pages.
Oh, I forgot an attachment... 🙄
Actually I changed my mind and used another solution (same root directory, two folders : one for extraction, one for installation) but thanks for the answer !
I finally had to use your solution pospec... And indeed I don't have 2 but 3 directory pages ! 🤪
But this brings another question... My script allows the user to choose which products he wabts to install, and depending on the ones he has selected in the !MUI_PAGE_COMPONENTS, I would like to display / hide the corresponding directory page.
For example, if I have these pages :
[CODE]
PageEx directory ; Product1 directory selection
DirText "Set Install Directory for ${Product1_name} :"
DirVar $Product1
Caption ": ${Product1_name}"
PageExEnd
PageEx directory ; Product2 directory selection
DirText "Set Install Directory for ${Product2_name} :"
DirVar $Product2
Caption ": ${Product2_name}"
PageExEnd
[CODE]
and if the user only ticks Product1 in the !MUI_PAGE_COMPONENTS, how can the page for Product2 NOT be displayed ?
Thanks !
But this brings another question... My script allows the user to choose which products he wabts to install, and depending on the ones he has selected in the !MUI_PAGE_COMPONENTS, I would like to display / hide the corresponding directory page.
For example, if I have these pages :
[CODE]
PageEx directory ; Product1 directory selection
DirText "Set Install Directory for ${Product1_name} :"
DirVar $Product1
Caption ": ${Product1_name}"
PageExEnd
PageEx directory ; Product2 directory selection
DirText "Set Install Directory for ${Product2_name} :"
DirVar $Product2
Caption ": ${Product2_name}"
PageExEnd
[CODE]
and if the user only ticks Product1 in the !MUI_PAGE_COMPONENTS, how can the page for Product2 NOT be displayed ?
Thanks !
pospec's example was for a classic install. If you use MUI, then you should be using the MUI_PAGE_DIRECTORY macros. Before inserting each macro, define your directory variable using MUI_DIRECTORYPAGE_VARIABLE.
If you then want to skip one of the directory pages, then use MUI_PAGE_CUSTOMFUNCTION_PRE function. In your function, you can check for the appropriate condition and then call ABORT if you want to skip the page.
If you then want to skip one of the directory pages, then use MUI_PAGE_CUSTOMFUNCTION_PRE function. In your function, you can check for the appropriate condition and then call ABORT if you want to skip the page.