MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Open Samples Directory[Next]: Regular Expression Tester
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->MAKEMSI Installs...->Installed Shortcuts and Options->Registry Conversion

Registry Conversion

This option is available on the right click (context) menu of ".reg" files and allows you to convert "REGEDIT4" formatted files into a MAKEMSI format requiring little manipulation for use in your scripts.

The "RegistryImport" command does the same thing but during MSI creation. Using this explorer option has the obvious benefits of slightly improving MSI build times and allows visual confirmation that everything is "fine".

Step #1 - Create the REGEDIT4 file

There are a number of ways you can get a text file in "REGEDIT4" format containing the registry information you are interested in, this shows the Windows "regedit.exe" tool being used under Windows XP:

The above created a text file with the extension ".reg" whose first line contains "REGEDIT4" to indicate its in the correct format.

Step #2 - Convert to MAKEMSI format

You now right click on the exported REGEDIT4 file and choose the convert option as shown:

You will probably wish to cut and paste the generated code into your main script, but inclusion of this file using the PPWIZARD "#include" command is another option.

Step #3 - Tweek the Generated Output

The output is a bit ugly, for this reason you may wish to reformat the generated script, other reasons include the need to treat certain registry items in particular ways or the need to convert hard coded file locations to use MSI formatting instead.

If all the values are related then you may wish to create a macro to simplify the setup as well as making the code a lot more readable.

The following creates a macro which can be used to set your applications registry options (as written will overwrite any existing):

#(
   ;--- Define macro so set application options in registry -----------------
   #define AppOption
   <$Registry
                HKEY="LOCAL_MACHINE"
                 Key="SOFTWARE\MyCompany\MyAppOptions"
                Name=`{$#1}`
               Value=`{$Value}`
             KeyPath="{$KeyPath='N'}"         ;;Optional parm (default = N)
       MsiFormatted="NAME,VALUE"
   >
#)

Example of the new macro being used:

<$Component "RegistryOptions" Create="Y" Directory_="INSTALLDIR">
   ;--- Component Keypath ---------------------------------------------------
   <$AppOption "Installed - By <$ProdInfo.ProductName> <$ProductVersion>" Value=^[Date] [Time]^ KeyPath="Y">

   ;--- Set many options ----------------------------------------------------
   <$AppOption "OptionA" Value=^a^>
   <$AppOption "OptionB" Value=^b^>
                ...
   <$AppOption "OptionZ" Value=^z^>
<$/Component>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Open Samples Directory[Next]: Regular Expression Tester


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Friday October 13 2017 at 2:08pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.