How can I install a plugin?: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Reverted edits by 172.29.30.66 to last version by Anders)
m (Grammar)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Plugin general information ==
== 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 hold bodies of plugin functions in form of Dynamic Link Library (DLL) and ".nsh"-files (header files) hold some data in plain text for using that functions with NSIS.
A [[:Category:plugins|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 [[wikipedia:Dynamic Link Library|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".
<blockquote>NSIS searches for plug-ins in the Plugins folder under your NSIS directory and lists all of their available functions. You can use <code>[[Reference/!addplugindir|!addplugindir]]</code> to tell NSIS to search in other directories too.</blockquote> -- NSIS manual, [http://nsis.sourceforge.net/Docs/Chapter2.html#tutplugin chapter 2 "Tutorial: The Basics"].


== NSIS plugin installation ==
== NSIS plugin installation ==
After downloading and unpacking a plugin one need 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.
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 installation example ===
[[Dialogs plug-in|"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".
[[Dialogs plug-in|"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 <code>${NSISDIR}\nsisconf.nsh</code> and <code>%AppData%\nsisconf.nsh</code>. These files provide a helpful place to put instructions shared by all your scripts.
 
<highlight-nsis>
; %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
</highlight-nsis>
 


[[Category:Plugins]]
[[Category:Plugins]]
[[Category:FAQ]]
[[Category:FAQ]]

Latest revision as of 11:11, 4 July 2018

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