Aaskilde
18th January 2011 09:18 UTC
How to install in more directories with one installer/one script?
Hey,
At first i am new at using NSIS codes, and i have been trying it out in one day, this is my second day using it so there is a lot i still do not understand!
I work for a firm who has asked me to try and make an installer to an application we have made, it's a application that need files placed some different places on the computer.
I have tried my way, but have not been able to find a solution to my problem, i found this but that is way to advanced for me i really do not understand it, http://nsis.sourceforge.net/Two_inst..._one_installer....
Is there a more easy way to do it, at this point i have made the simple tutorials from NSIS Wiki, and i had an idea that you could make something with the sections, maybe split them up with different installDIRs like this:
outFile "TestInstaller.exe"
section "InstallFirstDok"
installdir $DESKTOP
setOutPath $INSTDIR
file HM NIS Edit.exe
sectionEnd
section "InstallSecoundDok"
installdir $DESKTOP\TEST
setOutPath $INSTDIR
file Kaa.id
sectionEnd
section "InstallThirdDok"
installdir $PROGRAMFILES\TEST2
setOutPath $INSTDIR
file Linux projekt.docx
sectionEnd
section "InstallFourthDok"
installdir $DESKTOP
setOutPath $INSTDIR
file test.txt
sectionEnd
I know that the installdir can't be placed in the sections, but this is some of what i have tried.
If any can help me it would be a big relieve, i think it is really cool to try and program an installer but i have just hit a bump and can't find out what to do ! :)
-Aaskilde
jpderuiter
18th January 2011 10:26 UTC
You don't need to set InstallDir before the file command.
So if you want to have the files on a fixed location:
section "InstallFirstDok"
setOutPath $DESKTOP
file HM NIS Edit.exe
sectionEnd
section "InstallSecoundDok"
setOutPath $DESKTOP\TEST
file Kaa.id
sectionEnd
section "InstallThirdDok"
setOutPath $PROGRAMFILES\TEST2
file Linux projekt.docx
sectionEnd
section "InstallFourthDok"
setOutPath $DESKTOP
file test.txt
sectionEnd
If you need the user to select multiple installdirs by himself:
http://nsis.sourceforge.net/Setting_...Directory_Page
Aaskilde
18th January 2011 11:25 UTC
Okay thanks mate, i will give that a try! (:
Aaskilde
18th January 2011 11:38 UTC
Okay what you said is working correctly, but i need to include a path that goes by the Windows Registry, something like this maybe?
I have got the Registry path to work with a single file in it's own installer: $InstallDirRegKey HKLM SOFTWARE\Lotusnotes\Domino\1\ "DataPath", is it possible to include that in a section with the others?
outFile "TestInstaller2"
section "TEST1"
setOutPath $DESKTOP\TEST\TEST1
file Kaa.id
sectionEnd
section "TEST2"
setOutPath $DESKTOP\TEST\TEST2
file Linuxprojekt.docx
sectionEnd
section "TEST3"
setOutPath $DESKTOP\TEST\TEST3
file test.txt
sectionEnd
section "Regedit"
setOutPath $HKLM SOFTWARE\Lotusnotes\Domino\1\ "DataPath"
file Skype.lnk
sectionEnd
jpderuiter
18th January 2011 13:06 UTC
section "Regedit"
ReadRegStr $0 HKLM "SOFTWARE\Lotusnotes\Domino\1" "DataPath"
setOutPath $0
file Skype.lnk
sectionEnd
it's all in the manual...
Aaskilde
20th January 2011 10:12 UTC
Okay thanks a lot that really helped me! I know that pretty much everything is in the manual but i don't think it is that easy to understand just how they want the code written.
I got one more question if you will; Is it possible to move directories with the installer, i got a lot of smaller files that i need the installer to unpack in some different locations, its 4 or 4 directories that i need to copy into another directory, is that possible or am i going to write code for all the single files? :)
Aaskilde
20th January 2011 11:41 UTC
file /r NeoDashboard43_html\*.* made it work ;)