Archive: New user: Simple problem?


New user: Simple problem?
  Hi, I'd like to just start off by saying I am NOT a programmer of any kind. I actually inherited a project from a coworker who is quitting and I need to create a fairly basic installer.

I work for a textbook publisher. The goal of the installer is to extract a folder filled with educational data files for use with a 3rd party software. I have a copy of the folder ready to go (the way it should look on a student's computer).

Using the very basic ZIP to EXE function, I've been able to make a bare-bones installer that replicates my data folder in the correct location. However I need a license page and an accept page to go along with it.

I've DONE those (the license works, although I'm not quite sure how to add an image to my license page, i.e. the book cover) and the installation page both work fine. Unfortunately all I can figure out how to do is get the ZIP to copy to my destination folder; I can't get the contents of the zip to actually extract into the output folder.

I know I'm missing something fairly simple, but I've been looking over the manual and haven't seen anything that looks like a "run" or "extract" File command.

Here's what my very, very basic script looks like:

!include "MUI2.nsh"

Name "PROGRAM NAME"
OutFile "PROGRAM.exe"

InstallDir "C:\" <---the data needs to be installed in the root to work

!define MUI_ABORTWARNING

;--------------------------------
;Pages

!insertmacro MUI_PAGE_LICENSE "LA.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections

Section "NAME"
SetOutPath "C:\"
File "MYFILE.ZIP"
SectionEnd


What do I need to add to the section to get it to extract the zip contents instead of just copying it? (Also, I've tried using the exe made from my zip to see if it would actually run, but that file just gets copied too.)

A noob greatly appreciates your help. THANKS!


You could use Exec "$INSTDIR\MYFILE.EXE" command to run your exe file after the
"File MYFILE.EXE" line.


You need an extra plug-in, here is one of many: http://nsis.sourceforge.net/Nsisunz_plug-in

Add MYFILE.ZIP to a temp directory. $PLUGINSDIR is the temp directory used by the installer and automatically cleans itself up after the install is finished.
Goes something like this:

Section "NAME"


>SetOutPath "$PLUGINSDIR"
>File "MYFILE.ZIP"

>nsisunz::UnzipToStack "$PLUGINSDIR\MYFILE.ZIP" "$INSTDIR"
>Pop $R0
StrCmp $R0"success" +2
DetailPrint"$R0" ;print error message to log

SectionEnd
>
Add this line at the top so you can put the plug-in file in the same folder as your script:

. 


Here's a better idea: Don't distribute a zip, but the actual files themselves.

SetOutPath $INSTDIR
File /r "C:\YourProjectFolder\ProjectFiles\*.*"


You can find this information in the manual. Please read it:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1


As for your book image - if you want this separate from the license text but in the main dialog, you'll have to create your own custom license page. Otherwise, perhaps you could use it as a header image while using the ModernUI?

Edit: Or the ExperienceUI which looks like it has a nice big space on the left you might be able to stick a bitmap in.. http://nsis.sourceforge.net/ExperienceUI ..the example image just happens to be of the License page.

( apparently images included in a license RTF (Rich Text File) don't get displayed, or that might have been an option as well )


Originally posted by MSG
Here's a better idea: Don't distribute a zip, but the actual files themselves.

SetOutPath $INSTDIR
File /r "C:\YourProjectFolder\ProjectFiles\*.*"


You can find this information in the manual. Please read it:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1
Thank you, this actually is the most straightforward solution for what I need to do. (I actually stared at that particular page all afternoon yesterday-- I knew the answer was in there but I just wasn't making sense of it.)

This program is a lifesaver (as are the forums-- thanks to everybody for your extremely fast suggestions!)

Now I'll spend the rest of my time making the UI of the installer presentable. I've been reading a bit on custom pages but hopefully I can take it from here.

Cheers!