![]() |
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 |
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 |
Simply readregstr the proper value into $INSTDIR in your option page's leave function.
|
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: |
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.
|
Quote:
I'll give it another go though. Maybe this time it'll work out for me. :igor: |
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: |
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".
|
Quote:
Quote:
code: |
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 |
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. :p In case someone else as "slow" as myself happens to need this, here is the completed script: code: |
Nevermind the previous. I found that this works well enough for my purposes...
code: |
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
|
| All times are GMT. The time now is 17:26. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.