How can I install a plugin?: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Typo)
mNo edit summary
Line 19: Line 19:
!ifdef NSIS_WIN32_MAKENSIS
!ifdef NSIS_WIN32_MAKENSIS
!define NSISCONF_3 ";" ; NSIS 2 tries to parse some preprocessor instructions inside "!if 0" blocks!
!define NSISCONF_3 ";" ; NSIS 2 tries to parse some preprocessor instructions inside "!if 0" blocks!
!if ${NSIS_PACKEDVERSION} > 0x02ffffff
!addincludedir "$%AppData%\NSIS\Include"
; NSIS 3
!if ${NSIS_PACKEDVERSION} > 0x02ffffff ; NSIS 3+:
!define /redef NSISCONF_3 ""
!define /redef NSISCONF_3 ""
${NSISCONF_3}!addplugindir /x86-ansi "$%AppData%\NSIS\Plugins-i386-ansi"
${NSISCONF_3}!addplugindir /x86-ansi "$%AppData%\NSIS\Plugins-i386-ansi"
${NSISCONF_3}!addplugindir /x86-unicode "$%AppData%\NSIS\Plugins-i386-unicode"
${NSISCONF_3}!addplugindir /x86-unicode "$%AppData%\NSIS\Plugins-i386-unicode"
!else
!else ; NSIS 2:
; NSIS 2
!addplugindir "$%AppData%\NSIS\Plugins-i386-ansi"
!addplugindir "$%AppData%\NSIS\Plugins-i386-ansi"
!endif ;~ NSIS_PACKEDVERSION
!endif ;~ NSIS_PACKEDVERSION
!addincludedir "$%AppData%\NSIS\Include"
!undef NSISCONF_3
!undef NSISCONF_3
!endif ;~ !NSIS_WIN32_MAKENSIS
!endif ;~ NSIS_WIN32_MAKENSIS
</highlight-nsis>
</highlight-nsis>



Revision as of 18:50, 7 July 2014

Plugin general information

Plugin is a way of extending application's functionality by adding new functions. For NSIS plugins consist of two mandatory files (with extensions ".dll" and ".nsh") and some informational files ("readme.txt", "license.txt", help files with ".chm" extension). Files with ".dll" extension is 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 "license.txt" file). Then the ".dll" files must be put into "NSIS/Plugins" subfolder of NSIS installation and the ".nsh" files -- into "NSIS/Include" subfolder.

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 "C:\Program Files\NSIS\Plugins" folder and ".nsh" files must be extracted into "C:\Program Files\NSIS\Include" folder, supposing that NSIS installation name was 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