Skip to content
⌘ NSIS Forum Archive

NSIS skips files

11 posts

aleksanteri#

NSIS skips files

I am learning NSIS and, as a test, made an installer for the original Notepad. I also added just a readme.txt with a few lines of text 😁 and compied it with nsis. But I get just these messages:

Skipped: NOTEPAD.EXE
Skipped: readme.txt
Completed
Also the directory page disables the continue button 🙄
Comperio#
I looked at your sample script and have made a few obervations:

First, look at your FileExtract function:

Function FileExtract
File /a notepad.exe
File /a readme.txt
FunctionEnd
Since you are have not specified the path to the files, the compiler is going to assume the files are in the same directory as your install script. You should include the full path to the files like this:

Function FileExtract
File /a "C:\windows\notepad"
File /a "C:\pathToYourFile\readme.txt"
FunctionEnd
Next, look at this line:

Page instfiles confirm FileExtract ""
I wonder why you use the function FileExtract as your show function. It would be more logical to do away with the FileExtract function and instead put the commands directly in a section block. This way, the user can see the progress of file extraction and would have a progress bar to indicate how far along your installation is.

Third, look at this line:

InstallDir $PROGRAMFILES/Notepad
Couple suggestions here:[list=1][*]Use a backslash instead of a forward slash in the path.[*]Include quotes around the path. I usually do this mostly for good form. But it's also good practice to include quotes just in case you have a path with a space in the name. (ie "C:\program files").[/list=1]
And last, I noticed that you have set $INSTDIR to be "$PROGRAMFILES\Notepad" (from the command above). But, in the extraction function, you have not set an output directory. Insert this before your file commands:

SetOutPath "$INSTDIR"
(Alternatively, you can modify your file commands to include the /oname switch, which allows you to specify the output name/directory for each file. The drawback is that you can't use wild cards with the /oname switch.)

Edit:
Almost forgot:
The likely reason that your next button was disabled on your directory page was that the folder $PROGRAMFILES\notepad did not yet exist when the directory page was displayed. You'll either need to create the directory before displaying the page or (probably better) would be to utilize the "DirVerify leave" option, allowing you to confirm/create the directory before allowing the user to proceed. See the NSIS help for useage.
Afrow UK#
I'm sure his File instructions are fine, because if they weren't his script would not compile. However, missing SetOutPath is probably the issue.

aleksanteri: Why are your File instructions in a Function?
You won't see any progress bar movement unless you have them in a Section.

-Stu
aleksanteri#
Well thanks for showing my mistakes, but this is my first Nsis and I'm not that good here yet 😁

I thought I wouldn't need sections when I had the pages that were the progress... 🤪

Now I came up a question. How do I point to pages in a section?
Afrow UK#
You can't. You should always show pages first where you collect information and then do the installation in Sections.
If you start extracting files in between it won't become a simple uninstall if the user decides to cancel the setup before proceding to the install files page.

If you want to show a custom page depending on selected components, search the forum.

-Stu
onad#
Hi aleksanteri,

I think it may be helpful to you to try the examples that come with NSIS, you can learn a lot from them by changing the script in the example to to a little bit other things.

Welcome in the NSIS group, and good luck in your quest to the perfect installer...
aleksanteri#edited
Thanks, I will take a look in the examples to see the structure. 🙂

EDIT: The install now extracts files correctly. Thanks a lot for your help.