|
|
#1 |
|
Junior Member
Join Date: Nov 2012
Posts: 8
|
Choosing Between 2 Registry Path Options
I need to ask the customer to choose between installing our product to FSX or Prepar3D. Both programs have Registry Keys...
It seems like a simple enough task, but so far I've found nothing remotely similar in any of the documentation, examples, or even searching this forum. I am using "MUI2.nsh" just for sake of information. Desired binary dialog: ================== To which of these simulator programs do you wish to install this product? [ ] FSX [ ] Prepar3D ================== if FSX InstallDirRegKey HKLM "Software\Microsoft\Microsoft Games\flight simulator\10.0" SetupPath InstallDir "$PROGRAMFILES\Microsoft Games\Microsoft Flight Simulator X\" else if Prepar3D InstallDirRegKey HKLM "Software\LockheedMartin\Prepar3D" SetupPath InstallDir "$PROGRAMFILES\Prepar3D\" Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "MilViz_F86_vR1.121026.exe" ShowInstDetails hide Section "MainSection" SEC01 SetOverwrite on SetOutPath "$INSTDIR\Sound\MilViz" File "F:\Installer Build Folders\F86 Build Folder\Sound\MilViz\*.*" ;...snipped remainder of file for brevity... SectionEnd Section -Post SectionEnd |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
If the key and value specified by InstallDirRegKey exists it is copied to $instdir before any of your code runs, if you need something more advanced you have to do it yourself.
If you want check/radiobuttons on the components page/custom page to change $instdir you must do it with ReadRegStr IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#3 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
Simply readregstr the proper value into $INSTDIR in your option page's leave function.
|
|
|
|
|
|
#4 | |
|
Junior Member
Join Date: Nov 2012
Posts: 8
|
Thank you both for your replies, which I'm sure are excellent suggestions. While I am not inexperienced with coding logic, I am completely ignorant of this scripting language and its myriad options, nor quite honestly do I have any "free time" to devote to learning enough to answer my own question...
![]() The problem -which it appears that I have not made clear enough- is that I have no idea whatever how to create this dialog page to begin with, nor how to integrate it into my existing installer script... Quote:
This part is pseudo-code to illustrate the desired logic. At the moment, I have to build two separate installers for each of the two target simulator programs and comment out ( the two opposite lines, which seems to be very inefficient and clumsy:code: Last edited by n4gix; 2nd November 2012 at 18:11. |
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 462
|
Read the tutorial on nsDialogs; then you can create a custom page with two radio buttons. In the exit (leave) function you will read the button states and can perform the if/else (${IF} / ${Else} / ${EndIf} ) logic to set the installation directory and registry keys.
|
|
|
|
|
|
#6 | |
|
Junior Member
Join Date: Nov 2012
Posts: 8
|
Quote:
I'll give it another go though. Maybe this time it'll work out for me.
|
|
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Nov 2012
Posts: 8
|
Okay, I've made some progress, but I cannot figure out how to select only one of the two options. I was hoping that the ${if} statement would work, but obviously I've not got it correct yet:
code: |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Nov 2005
Posts: 115
|
Use ${NSD_CreateRadioButton} instead, since you say only one option can be selected. Also you didn't get the state of 'Checkbox2' and you don't have an item named "Text".
|
|
|
|
|
|
#9 | ||
|
Junior Member
Join Date: Nov 2012
Posts: 8
|
Quote:
![]() Quote:
code: |
||
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Nov 2005
Posts: 115
|
You can't use InstallDirRegKey or InstallDir in a function/section.
Use ReadRegStr to read the key to change $INSTDIR. For example: ReadRegStr $INSTDIR HKLM "Software\LockheedMartin\Prepar3D" SetupPath |
|
|
|
|
|
#11 | |
|
Junior Member
Join Date: Nov 2012
Posts: 8
|
Quote:
Now my Radio Buttons are correctly selecting the install path and I can move on. Pity it took so long, but since every project uses this same template, I won't have to mess with it again. While I have attention though, could someone explain how to use this? Page license I have a license text file already that I've been using with this function from HM NIS Edit": !insertmacro MUI_PAGE_LICENSE "F86_License.txt" It would simply look nicer to have it in better integrated with the nsDialogs if possible. ![]() In case someone else as "slow" as myself happens to need this, here is the completed script: code: |
|
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Nov 2012
Posts: 8
|
Nevermind the previous. I found that this works well enough for my purposes...
code: |
|
|
|
|
|
#13 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
Most of the MUI page macros are wrappers around the built-in NSIS pages and they can be configured with the MUI defines listed in the MUI readme, in your case MUI_LICENSEPAGE_CHECKBOX
IntOp $PostCount $PostCount + 1 |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|