NSIS Text Editor Mode

This example creates an FWB extension that lets us work with Nullsoft Installer Scripts (NSIS) from inside FWB. The sample uses quite a bit of the FWB scripting API, so it’s a useful introduction to FWB scripting in general as well.

The extension is developed as a text editor addon, a MiniAppMode that is merged to a text editor MiniApp when a NSIS script is opened:

This extension comes alive whenever we open a file with NSIS content, it shows its toolbar and binds some keys. We can run the NSIS compiler from a button in the editor and click hi-lighted errors in the compiler output to jump directly to them. We can run the installer and open the NSIS help file.

When done and we close the file, the NSIS mode is disconnected and its toolbar removed.

In around 300 lines of Squirrel script, we manage to create a ‘micro IDE’ for NSIS scripts that integrates well into FWB.

Note: This extension works best under Windows. Under Linux, it still can be activated, but it will fail to locate the NSIS compiler and to build the scripts. Of course, to be useful, one has to install the NSIS compiler.

Two MiniAppMode Extension Classes

To implement this extension, two new Squirrel classes are created. Both implement the MiniAppMode interface:

The file <FWB>/scripts/squirrel/NsisMode.nut contains the source code for these two modes. By default, this file is not included from FWB Squirrel startup scripts.