Tutorial #3: Working with registry keys

NOTE: You should be familiar with using regedit for this tutorial.  If you have never used regedit before go out on the Internet and learn up on it a little bit.  Then come on back.  Don't worry I'll wait for you.

Working with registry keys is very much like working with files in that they both make use of define groups.  Many of the columns on the registry tab are drop down combo boxes which you select choices from rather than typing in information directly.  Again I will go through a basic example on how to add a single registry subkey and a few values just so you can get a feel for how the process works.  I'm sorry to say you will likely have to do some typing.  I apologize in advance. 

Open up our good friend "Example1.sg2" and select the "Registry List" tab.  Right off the bat you'll notice that the two registry items listed here do not have their checkboxes selected.  This was because I didn't want to freak you out in Tutorial #1 by installing stuff to the registry.  For this tutorial all you need to do is select the checkboxes next to each registry item so they are enabled and you'll get some registry keys installed when you're done this tutorial.  Please note however that you will need to delete these keys yourself as there is no uninstaller setup for the Example 1 document.  Regedit can be used for that purpose hence the notice that you should be familiar with regedit.

What are the options we have here...

 

Registry list tab

 

You'll notice I've made use of some special NSIS constants for the registry values.  $INSTDIR is of course the installation directory on the installing machine.  ${VERSION} is a constant I have defined in the Example 1 define listing.  Head over to the "Define List" tab and you'll see an item "VERSION" there.  The syntax is in accordance with the NSIS scripting language so you can use any constants valid in NSIS as well.

After running the installer open up regedit and check out...

     HKLM \ SOFTWARE \ Example1

You should see something like the following...

 

The registry after running the Example 1 installer

 

There you have it registry keys in action! Don't forget to delete the Example 1 key folder as this is not done for you.

Made with CityDeskSourceForge.net Logo