Familie Fesevur

JavaScript Macros for Notepad++
maandag 05 oktober 2009 14:37


NppJavaScript is a GPLv2 licensed plug-in for Notepad++ to extend it to add editable JavaScript macros. Notepad++ is a free (free as in "free speech" and also as in "free beer") source code editor and Notepad replacement, which supports several programming languages, running under the Microsoft Windows environment. The plug-in uses the Mozilla JavaScript engine SpiderMonkey version 1.7. SpiderMonkey is used in all Mozilla products like Firefox and Thunderbird.


To download version 0.3.0, click here. To download the sources, click here.

How to install

Copy NppJavaScript.dll to the plugins directory and restart Notepad++. Note that this is a Unicode plug-in, so at least Notepad++ 5.1 is required.

How to use

Create a simple script like below and save it somewhere. Start the plug-in by selecting "Run JavaScript..." from the "Plugins" menu, by pressing Alt+M or press the JavaScript button on the toolbar, select the script file you have saved and see the magic. Error messages are shown on the console window that can be activated from the "Plugins" menu as well.

An incomplete documentation of the functions can be found here.

Sample script

insertText("We started here.");
var i;
for (i = 0; i < 3; i++)
insertText("We went up three lines.");

Why JavaScript?

Why did I choose to integrate JavaScript and not another popular scripting language? Well there is no real reason. I personally do like JavaScript and I know not every does.

Release history

Version 0.3.0 (26 November 2008)

  • Added a lot of new functions. It can be used actually.
  • A dockable console window. It needs much optimization. The GetDlgItemText() and SetDlgItemText() combination is not efficient at all. And newline are shown as boxes. And it is likely to cause various problems as well.
  • Fixed crash in release build. Many thanks to LoonyChewy for the patch.
  • Started to write some documentation. The functions are described in an XML-file. With various XSL transformations that can be converted to various forms of output.

Version 0.0.1 (10 November 2008)

  • Not a real release. Posted a note in the forums about the development and provided a download link to the source to ask for help because of problem with release build.
  • Release build crashes Notepad++ when a variable is declared with var i;