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'

    InstallOptions::dialog "$PLUGINSDIR\test.ini"

    NSISdl::download http://download.nullsoft.com/winamp/client/winamp291_lite.exe $R0

The plug-ins that NSIS knows of are listed at the top of the output of the compiler. 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 included 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, have a look at the Docs folder for help files and examples. You can find additional plug-ins on-line: 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