alpuppy
25th March 2008 21:21 UTC
Install to Local Disk with HM NIS
This is my first run at creating an installer, I'm using HM NIS edit to make my nsi script, what I'm trying to do is get the installer to install in c:/(my folder name here)
I can't figure out how to do that though.
any tips?
AaronLS
25th March 2008 21:52 UTC
I'm not sure exactly what you mean by "get the installer to install in". You mean where you want the files to be placed? Some clarification and examples would be helpful.
I believe in the *.nsi script HM generates there will be two lines of the form:
!define DEFAULT_DIR "C:\SomeDir"
InstallDir "${DEFAULT_DIR}"
You can modify the first line to change the default destination. You won't get too far with the wizard though. I tried HM first and soon switched to Notepad++. Then I read the NSIS User manual page by page. I got as far as section 4.9 before I got bored with reading about each instruction, but it has proven valuable, because it made me aware of all the capabilities available to me.
alpuppy
25th March 2008 22:19 UTC
ok sorry for not being more specific.
I am using the wizard so that could be a problem, but I don't have any experience with this so that sort of noob setup is good for me.
the part I'm talking about is "Application default directory" and the choices it gives me (in the wizard) are:
$PROGRAMFILES\My application
$TEMP
$DESKTOP
$SYSDIR
$EXEDIR
$WINDIR
$STARTMENU
$SMPROGRAMS
$QUICKLAUNCH
I looked through the output code that HM generated and I couldnt' see either of those lines.
does notepad++ have a wizard by chance?
AaronLS
25th March 2008 23:23 UTC
Is (my folder name) something you are coming up with right now, or is it something that will be set at runtime?
Ok, I just ran through the wizard, just type for the Application default directory:
c:\ThisIsAFolderName
Or whatever you want it to be. You don't necesarily have to choose from the options in the drop down. After the wizard finishes and it generates the script, it had created this line on line 41:
InstallDir "C:\ThisIsAFolderName"
This statement basically sets the $INSTDIR property to "C:\ThisIsAFolderName". You'll notice later in the file it writes fields to that location with commands like:
SetOutPath "$INSTDIR"
Notepad++ does not have a wizard, all it has is snytax highlighting for the files. I used HM to generate the initial script, but have done most of the editing with Notepad++. The problem I have with depending on a wizard is if you decide that "Oh, I want to do this slightly differently." then you have to go back through the same wizard and remember which options you chose initially, except for that one change. So it's just a personal preference of mine. It's a great learning tool initially though, as you can see how what you do in the wizard effects the script output. I would suggest making an effort to understand the script it generates and using the NSIS manual to look up commands frequently.
alpuppy
27th March 2008 21:45 UTC
I have the folder name picked out, it's going to be ODLink.
I just tested it on mine and that works great, silly me. Thanks so much for your help. I think I'll get Notepad++ though. I would go about it the same way as you, generating the script in HM, I just know there's no way I want to get to the point where I can create the whole script myself in notepad, too much else to work on right now.
thanks for your help, my setup file is running good.
I do have 2 more questions that I hope I can tack onto this thread.
How do I pick an icon for my website link that's located in the start menu.
And how would I define the icon for the file I'm putting on the desktop? It's a filemaker file so it defaults as the filemaker icon, but I want to change it so it shows as my company logo, I know how to make an icon, I've already done that, and I know how to right click, properties, etc...to manually use my icon as the icon, but is there a way to make the setup do it.
thanks aaron
AaronLS
27th March 2008 22:32 UTC
Search your script for CreateShortcut commands. The ones that create shortcuts in the start menu will begin like this:
CreateShortCut "$SMPROGRAMS\
Then lookup CreateShortcut in the index of the NSIS User Manual which tells you how to add icons to your shortcut.
Here is an example from the manual that I modified a little:
CreateShortCut "$SMPROGRAMS\My Company\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.URL" "" "$INSTDIR\My Program.exe" 0
If your ${PRODUCT_NAME}" is set to ODLink for example, then this will create a link that is under "My Company" in the start menu called "ODLink.lnk" (but will just show up as ODLink since the .lnk extension is hidden). The "$INSTDIR\${PRODUCT_NAME}.URL" is the destination of the link(a previous Writeini statement would have create the .url file). The empty string "" is optional command line paramters to pass to the destination program, since this is just a url that is not needed.
"$INSTDIR\My Program.exe" is the the file to get the icon from. This could be an exe or dll that already contains icons, or I think it can be an *.ico file as well. The number 0 is the index of the icon in the My Program.exe. I believe you can have multiple icons in an exe or dll so you could have 1 or 2 or something greater.
So if you already have an exe such as My Program.exe that has an icon you want to use, try referencing it and try 0 for the index. If you want to experiment with referencing an *.ico file, make sure you copy the file to the destination computer first.
For the second question, if it has an icon based on it's filename extension, you can't change it without affecting all other files of that type on the system. I would suggest placing the file in your application directory, and creating a shrotcut to it on the desktop with the CreateShortcut command, and using the icon parameters of the CreateShortcut command to set the icon for the shortcut.