The "IniImport" Command |
This command is used to import a standard ".ini" file. You can filter out whole sections or particular parts of the INI file and you can change the values, for example you may wish to translate "c:\fred" to "[INSTALLDIR]"...
You can also use the "INI Conversion" explorer option to convert an INI file and manually include all or parts of the generate MAKEMSI script.
This command takes these parameters:
The default for this parameter can be set via the DEFAULT_INI_HOW macro. The initial value is "ADD_OR_UPDATE".
Due to Windows Installer limitations not all such references can be handled so "c:\winnt\" will be translated but "c:\winnt" will not be.
The default for this parameter can be set via the DEFAULT_INIIMPORT_SPECIALFOLDER_TRANSLATIONS macro. The initial value for this is "Y".
It is possible to alter the import configuration. See "ImportTranslations.mmh" for more information, the following worked for one user:
#( <$ImportTranslationAdd FromExp=^'C:\Program Files\MyTopDir\'^ ToExp=^'[INSTALL_BASE_FOLDER]'^> > #)
EXAMPLE |
;--- Filter INI Import ------------------------------------------------------ #DefineRexx+ 'INIIMPORT_HOOK_SECTION' ;--- We don't want all [sections] --------------------------------------- if translate({$SectionVar}) = translate('Microsoft Paradox Driver (*.db ) (32 bit)') then {$WantVar} = 'N'; #DefineRexx #DefineRexx+ 'INIIMPORT_HOOK_KEYVALUE' ;--- Drop all "Setup" keys ---------------------------------------------- if translate({$KeyVar}) = "SETUP" then {$WantVar} = 'N'; else do ;--- Change value for "32Bit" to "99" ------------------------------- if translate({$KeyVar}) = "32BIT" then {$ValueVar} = '99'; end; #DefineRexx ;--- Do the actual Import --------------------------------------------------- <$Component "INI" Directory_="INSTALLDIR" LM="Y"> <$IniImport "<??*SystemRoot>\ODBCINST.INI" IniFile="NewIni.ini" IniDir="INSTALLDIR"> <$/Component>