Working with NSIS' screen-saver installer

Wrapping up building an installer with NSIS, figuring out which registry keys to set, finding a small residual probem, and discovering an OS X version of VNC.

In my discussion last week about developing a screen-saver installer I left off at the point where I used the freeware Mihov NSIS Helper to create a simple prototype installer script. This script is designed to be turned into a Windows installer application by Nullsoft's outstanding free open source Nullsoft Scriptable Install System, or NSIS.

But a Windows screen saver is essentially system software so more work was needed. For a start, the screen-saver installer has to put the .scr file in the Windows system subdirectory (by default named system32), which is usually under the Windows subdirectory (by default c:\Windows). Of course, this isn't a certainty so you really need to use what the system tells you is the actual directory, so in the NSIS script you have to specify the installation directory accordingly: InstallDir "$SYSDIR".

NSIS also has a number of other predefined constants such as $SYSDIR, $PROGRAMFILES, $DESKTOP, $STARTMENU, and $QUICKLAUNCH; these simplify scripting considerably.

Now, to install a screen saver it is not enough to copy the .scr file to the system directory. Actually it is enough if the user is willing to run the Windows control panel display applet and on the screen-saver tab select the newly installed screen saver. But I wanted to be a little more polished than that, so it was time to do that most dangerous of system changes: Modify the registry.

I write “most dangerous” with tongue firmly in cheek. Given the number of ways you can easily damage or destroy a Windows system, modifying the registry isn't really that perilous, but Microsoft has always been a little obsessive on the topic.

The registry keys for screen savers for the current user can be found in the HKEY_CURRENT_USER (otherwise aliased as HCKU) hive, Microsoft's rather odd name for the major logical sections of the registry.

The first key we need to change is Control Panel\Desktop\Scrnsave.exe, and we need to set it to the file name of the screen saver we just copied into the system directory. If you are in the habit of browsing the registry you'll notice that the entire path is often included in this key, but Microsoft notes that if you are, in fact, using the system directory the path is assumed.

Next you need to set the key Control Panel\Desktop\ScreenSaveActive to "1", which, as you might guess, ensures that the screen saver is active.

And that's it. (But I found a weird thing. After my installer runs, everything is set up fine and the screen saver runs, but the display applet claims that no screen saver is selected. Odd.)

The last thing I did was tweak the graphics that are used by the installer's user interface. Under the NSIS installation directory you'll find the graphics in Contrib\Graphics\Wizard. If you are using the default NSIS setup, then editing the win.bmp file changes the left-side graphic on the installer welcome page. I leave it as an exercise for the reader to find the other graphics.

That's it. If you want the installer script and the screen saver, send an empty message with the subject “NSIS Demo” to

My final thoughts this week are on VNC, an excellent free, open source, remote control application. I just found a version of the VNC client for OS X! It is called – and I love this – “Chicken of the VNC”!

COTVNC is a SourceForge project, and despite its last release being in January, 2006, it works great! That said, be warned: There are a few outstanding issues with COTVNC.

So, next week we resume our look at Parallels Vortuozzo Containers 4.0 and try to remember what started us getting on that product in the first place.

Gibbs keeps muttering “so much technology, so little time” in Ventura, Calif. Sympathize with

Learn more about this topic

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.
Now read: Getting grounded in IoT