Reading All Key Names from .ini Files

InstallShield 2024

Project: This information applies to the following project types:

Basic MSI
DIM
InstallScript MSI
Merge Module
MSI Database
MSM Database
Transform

To read all of the key names from a section in an .ini file, use the following script:

function OnBegin( )

    STRING svAllKeyNames; // filled in by GetProfString

    LIST listKeyNames; // string list containing key names

begin

 

// read a single value

GetProfString(

    "\\\\Server\\Config\\Test.ini", // file name; note the double

backslash for each "real" backslash

    "ProductSettings", // section name without square brackets

    "", // key name; null string "" means to get all key names

    svAllKeyNames); // STRING variable to store key names

 

listKeyNames = ListCreate(STRINGLIST);

 

// take apart string containing key names

StrGetTokens(listKeyNames, svAllKeyNames, "");

 

SdShowInfoList("Key names", "Here they are:", listKeyNames);

 

// if desired, you can loop over the key names in the list and read each

key's value...

 

ListDestroy(listKeyNames);

 

end;