Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 30th August 2002, 09:44   #1
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
NSIS - The FAQ

Outdated! See the new FAQ.

Welcome to the NSIS forum, please take the time and read this thread before asking questions. It may save some time for all of us.

Last update: 18 March 2003

I have a question related to NSIS
Please follow these simple steps to find your answer
  1. Read the documentation (makensis.htm)
  2. If you have missed it, have a look at appendix B: Useful Functions
  3. Search the NSIS Archive
  4. Read this FAQ
  5. Search the forum
  6. Post a question in the forum.
You might also want to try the official NSIS IRC channel: #nsis @ irc.landoleet.org.


The FAQ

Where can I download NSIS?
You can find the latest version at http://www.nullsoft.com/free/nsis/.
The latest development version can be found at the NSIS SorceForge page.
More information about the latest developments can be found in here
Some modifications are also available at the NSIS Archive

What is the latest version of NSIS?
NSIS 1: 1.98 (official), 1.99 (unofficial)
NSIS 2: 2.0b3 - development build

Where can I find out what's cooking for the next version?
Have a look at the development change log.
You can download the latest development version from here or from CVS as explained here. Starting at version 2.0b2 you can also update NSIS using NSIS Update that comes with NSIS. You can access NSIS Update from the new NSIS Menu (NSIS.exe) or from Bin\NSIS Update.exe. NSIS Update can check if you have the latest released version, or update to the latest CVS version.
Currently in CVS - version 2.0b4.

Where can I find some example scripts?
Examples can be found in the directory where you installed NSIS. If you have installed version 2.0a1 and above, it is in the Examples directory. If you have installed 2.0a0 or below it is in the NSIS directory itself (all of the files with the .nsi extension).
You can also have a simple script generated for you here.

I have found a bug!
Search the forum before you post it, it might have been addressed already. If you can't find a refernce to your bug in the forum post a new topic. If it is a bug in the development version please post the bug in the SourceForge project page.

I always get error #12345 when I try to compile very large installers. What's up with that?
NSIS can theoretically compile installers as large as 2GB. This is first limited by the amount of free disk space on the drive containing the system temporary directory. This drive must be formatted as NTFS and must have enough free space to hold the temporary file, which can get upto 2GB depending on the packed files. This means you can't compile very large installers on Windows 9x because it doesn't support NTFS. The limit is about 700MB on a FAT partition.
More RAM and virtual memory will only help speed up the process but won't increase the limit.

I think NSIS is missing some command...
There are a lot of commands that could have been added into NSIS, but most of them will just make NSIS into bloatware, and no one wants that. You will be surprised at what you can do with the NSIS scripting language. Search the forum, and the NSIS Archive, there is a pretty good chance someone has already made what you are looking for.
NSIS can also fire up DLLs to do the job for it. Search the NSIS Archive for such, or try writing your own (have a look at ExDLL in the contrib directory).
If you still think the command you are missing should be in NSIS, and it can't possibly be done with NSIS scripting, or it takes 3000 lines of script, post a message in the forum or request a feature at the SourceForge project page.

NSIS is ugly! How can I make it look better?
Have a look at the latest development build of NSIS. It offers a lot of UI improvements, including a new modern wizard style, like the wizards of recent Windows versions.

Is there any program that could help me script?
Have a look at the NSIS related software category at the NSIS Archive.

How can I get input from the user?
Use Install Options to create custom dialogs during the installation process. You can find Install Options (IO) in the Contrib directory.

I am having problems with CreateShortCut
Make sure you have separated the parameters from the target file.
For example, if you want to create a shortcut to notepad with $INSTDIR\Readme.txt as a parameter don't use:
PHP Code:
CreateShortcut "myshortcut.lnk" "notepad.exe $INSTDIR\\Readme.txt" 
Use two separate strings:
PHP Code:
CreateShortcut "myshortcut.lnk" "notepad.exe" "$INSTDIR\\Readme.txt" 
I am reading a file name from another file and Delete/FileOpen/CopyFiles/<insert files related command here> doesn't work with with the file name I have read! What do I do?
You probably forgot to remove the new line character from the end of the line. Use TrimNewlines to remove it. For example:

PHP Code:
FileOpen $"somefile.dat" "r"
FileRead $$1
FileClose 
$0
Push 
$1
Call TrimNewlines
Pop 
$1
Delete 
$
How can I write strings with quotes to the registry?
Just quote the entire string with a single quote.
NSIS allows you to use three kinds of quotes: ', `, and ".
For example:
PHP Code:
WriteRegStr HKCR "myFile\\shell\\open\\command" "" '"$INSTDIR\\myprog.exe" "%1"' 
How can I make sure the user installing my software has admin rights?
Use the IsAdmin DLL to find out.
If you are using version b0 or above you can use UserInfo.dll in your contrib folder.

How can I read or write files?
Use FileOpen, FileRead, FileWrite, FileSeek, and FileClose to manipulate files.
You can find a small example showing how to replace a line here.
Note that if INI files are in the question, it might be easier to use WriteINIStr, ReadINIStr, DeleteINIStr, and DeleteINISec.

How can I make my script depend on some registry value/the version of my product/<something dynamic>?
Write another installer for your use that will write the script for you, or compile it for you with /DNAME=value or /X"nsis command" passed on to makensis.exe as command line arguments. The /D switch will define NAME as value in the script. The /X switch will add "nsis command" to the top of the script.

Example:
In the compiling script:
PHP Code:
ExecWait "makensis.exe /DVERSION=1.2 myscript.nsi" 
In the compiled dynamic script:
PHP Code:
OutFile myprog${VERSION}.exe 
When I use ExecWait uninstaller.exe it doesn't wait for the uninstaller. Why?
NSIS uninstaller copies itself to the temporary directory, runs the temporary uninstaller create and then exits. This is done so it will be able to delete itself. To force the uninstaller not to do this use:
PHP Code:
ExecWait '"$INSTDIR\\uninstall.exe" _?=$INSTDIR' 
You will, of course, have to replace uninstall.exe with the name of your uninstaller.

I want to create a syntax file for my favorite edior, how do I get a list of all NSIS commands?
Run makensis.exe /CMDHELP to get a list of available commands. The nsExec example does this so you can just copy of the install log using the context menu. The same list is available in Source\tokens.cpp. The list of variables is in Source\script.cpp on the top.

FAQ additions
If you think something is missing in this FAQ send me a PM, or just reply here. Please post only suggestions, fixes or addiotions to FAQ in this thread.
kichik is offline   Reply With Quote
Old 23rd December 2002, 18:05   #2
liquidmotion
Smokes Two Joints
Beta Team
 
liquidmotion's Avatar
 
Join Date: Feb 2001
Location: SFBA
Posts: 3,680
Send a message via ICQ to liquidmotion
Here are links to my NSIS GUI's / wizards:

http://www.morphedmedia.com/software.php - Slate Blue, the original GUI, with (ugly) source. 2.03mb

http://www.morphedmedia.com/software.php - Slate Blue NSIS Wizard, a new wizard for NSIS, creates a little more than a basic script. 205kb.

I do plan on porting the ugly source of Slate Blue to Delphi in the near future. SO if you've got any suggestions on how it should work, how to make it better, whatever, let me know.

http://www.morphedmedia.com/download/ for more downloads.

For a good time: shup | stashbox | my homepage
liquidmotion is offline   Reply With Quote
Old 12th January 2003, 15:42   #3
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
How to install the VB6 runtimes

Check http://nsis.sourceforge.net/archive/....php?pageid=47
Joost Verburg is offline   Reply With Quote
Old 23rd April 2003, 09:09   #4
virtlink
Major Dude
 
virtlink's Avatar
 
Join Date: Sep 2002
Location: At [4C69:6E6B]
Posts: 561
Known NSIS Issues

You'll find information about features of NSIS that don't always do what you expect, issues with NSIS that aren't bugs but might be confusing to new users, etc... here:
http://nsis.sourceforge.net/archive/...35&instances=0
virtlink is offline   Reply With Quote
Old 21st July 2003, 14:57   #5
Mr_007
Banned
 
Mr_007's Avatar
 
Join Date: Feb 2003
Posts: 2,838
Good Tips!
Mr_007 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump