Plug-ins

NSIS

Previous | Contents | Next

2.6 Plug-ins

NSIS support plug-ins that can be called from the script. Plug-ins are DLL files written in C, C++, Delphi or another programming language and therefore provide a more powerful code base to NSIS.

A plug-in call looks like this:

DLLName::FunctionName "parameter number 1" "parameter number 2" "parameter number 3"

Every plug-in's function has its own requirements when it comes to parameters, some will require none, some will accept as many parameters as you want to send. Examples:

nsExec::ExecToLog '"${NSISDIR}\makensis.exe" /CMDHELP'
Pop $0 ; Process exit code or "error"
InstallOptions::dialog "$PLUGINSDIR\test.ini"
Pop $0 ; success/back/cancel/error
NSISdl::download http://download.nullsoft.com/winamp/client/winamp291_lite.exe $R0
Pop $0 ; "success" or a error code

The plug-ins that NSIS knows of are listed at the top of the compiler output (verbose level 4). NSIS searches for plug-ins in the Plugins folder under your NSIS directory and lists all of their available functions. You can use !addplugindir to tell NSIS to search in other directories too.

The NSIS distribution already includes many plug-ins. InstallOptions is a popular plug-in that allows you to create custom pages, in combination with the NSIS Page commands (See Pages). The Startmenu plug-in provides a page that allows the user to choose a Start Menu folder. There are a lot of plug-ins for different purposes, take a look in the Docs folder for help files and examples. You can find additional plug-ins online: NSIS Wiki.

You can also create a plug-in yourself. C/C++ and Delphi header files are already available, see the example plugin for how to do this. Source code of included plug-ins can also be found in the source code package.

Previous | Contents | Next