Archive: Custom InstallDir from Registry+subfolders


Custom InstallDir from Registry+subfolders
Hi. I am a newbie at programming, so I have difficulties in doing this: I'm trying to build an installer that gets a path for the INSTDIR from the registry and then concatenates that with something else. For example, I have a string value in the registry that is : "C:\Myprogram\". I want to add to that path (without changing the registry) a subfolder, like "C:\MyProgram\Install Here". How do I do that ? :cry:

I also have a question about RegDLL. I get an error message that says "unable to load DLL". If I use RegSvr32, it works OK.

Thanks.:winamp:


In .onInit, change $INSTDIR with StrCpy. For example:

Function .onInit
StrCpy $INSTDIR "$INSTDIR\Install here"
FunctionEnd
To get rid of the RegDLL error, use SetOutPath to set the current working directory to where the DLL is before registering it.

Thank you kichik. I'm trying to use InstallDirRegKey to get the path from the registry. Lets say its "C:\MyProgram\". How do I tell the installer to copy sme files to "C:\MyProgram\Folder_1" and then to copy something else to "C:\MyProgram\Folder_2", using the path from the registry ?


Read some examples into NSIS folder.
For example you can use:
InstallDir "$PROGRAMFILES\MyProgram" #default value
InstallDirRegKey HKLM "somepath" "somekey" #previous path (will override default value)
Section "Section_Name" SEC01
SetOutPath "$INSTDIR\Folder_1"
File "file1.exe"
File "file2.exe"
SetOutPath "$INSTDIR\Folder_2"
File "file3.exe"
<other commands>
SectionEnd
Section -Post #to remember new Path, if you will change it with Browse button
WriteRegStr HKLM "somepath" "somekey" "$INSTDIR\filename.exe" #filename.exe - file from your program
<other commands>
SectionEnd