How can I install a plugin?

From NSIS Wiki

(Redirected from How can I install a plugin)

Plugin general information

A plugin is a way of extending application's functionality by adding new functions. NSIS plugins consist of one mandatory file (with the extension ".dll"), usually a header file (with the extension ".nsh") and some informational files ("readme.txt", "license.txt", help files with ".chm" extension). Files with ".dll" extension are the main part of the plugin in form of a Dynamic Link Library (DLL) and ".nsh" files (header files) often contain defines or helper macros that are used when calling the plugin.

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.

-- NSIS manual, chapter 2 "Tutorial: The Basics".

NSIS plugin installation

After downloading and unpacking a plugin one needs to accept the license agreement (residing in the "license.txt" file if applicable). Then the ".dll" files must be put into the "NSIS\Plugins[\platform]" subfolder and the ".nsh" file into the "NSIS\Include" subfolder.

NSIS v2 only supports ANSI plug-ins and they are stored in "NSIS\Plugins". NSIS v3 supports multiple targets and plugins are stored in subfolders under "NSIS\Plugins\".

Dialogs plugin installation example

"Dialogs" plugin is distributed in a form of ZIP-archive named "Dialogs.zip". The archive contains 4 mandatory files: "dialogs.dll", "defines.nsh", "ZipDLL.dll" and "zipdll.nsh". The last two forms ZipDLL plug-in which is used by the "Dialogs" plugin. All ".dll" files must be extracted into the "C:\Program Files\NSIS\Plugins" folder (NSIS v2) and ".nsh" files must be extracted into "C:\Program Files\NSIS\Include" folder, supposing that the NSIS installation path is the default ("C:\Program Files\NSIS").


Multiple NSIS installations

If you have several versions of NSIS installed at the same time it can be useful to put all 3rd-party plugins in a common location. When MakeNSIS is started it parses ${NSISDIR}\nsisconf.nsh and %AppData%\nsisconf.nsh. These files provide a helpful place to put instructions shared by all your scripts.

; %AppData%\nsisconf.nsh example
!ifdef NSIS_WIN32_MAKENSIS
!define NSISCONF_3 ";" ; NSIS 2 tries to parse some preprocessor instructions inside "!if 0" blocks!
!addincludedir "$%AppData%\NSIS\Include"
!if ${NSIS_PACKEDVERSION} > 0x02ffffff ; NSIS 3+:
!define /redef NSISCONF_3 ""
${NSISCONF_3}!addplugindir /x86-ansi "$%AppData%\NSIS\Plugins-i386-ansi"
${NSISCONF_3}!addplugindir /x86-unicode "$%AppData%\NSIS\Plugins-i386-unicode"
!else ; NSIS 2:
!addplugindir "$%AppData%\NSIS\Plugins-i386-ansi"
!endif ;~ NSIS_PACKEDVERSION
!undef NSISCONF_3
!endif ;~ NSIS_WIN32_MAKENSIS
Personal tools
donate