ReadPropertiesFile
(System Library)
Description | Reads a single Settings file and returns an INIFile Structure. Replaces ReadINI and ReadSectINI |
Returns | INIFile Structure. See comments. |
Usage | Script Only. |
Function Groups | Configuration Management, File I/O |
Related to: | WritePropertiesFile | GetINIProperty | ReadConfiguration | SetINIProperty |
Format: | System.ReadPropertiesFile(File[, IsBuffer, SuppressOrphanedComments]) |
Parameters |
File |
Required. Any text expression giving the full path and file name of the Settings file or the buffer containing its contents, depending on the IsBuffer parameter. |
IsBuffer |
An optional logical expression. Set TRUE if the File parameter is a buffer. Defaults to FALSE (0). |
SuppressOrphanedComments |
An optional logical expression. If TRUE then "+PseudoProperty"s - comments that aren't associated with a property will be left out. Defaults FALSE. |
Comments |
Returns arrays that are ordered by how they appear in the Settings file. The INIFile structure returned is as follows: INIFiles Struct [ FileName { full path and file name to the settings file }; OEM { TRUE if an OEM layer file }; Workstation { Name of the workstation or invalid if global }; Layer { Instance of application layer owning the file }; Dynamic { TRUE if a dynamic property }; Sections { Dictionary of sections each element of which is an array of Property structures }; Changed { User sets to true if the file has been changed, initialized to false }; ] The INIProperty structure is… INIProperty Struct [ Name { Variable name in the .startup/.dynamic file }; Value { Simple value }; Comment { Text comment if present in the file }; Hidden { TRUE if not visible in Edit Properties GUI }; ]; The INIFiles structure can be modified using SetINIProperty. Note that if your intention is to read a configuration file, this function should be called from within a ReadConfiguration callback or a ModifyConfiguration callback. |
Example:
Properties = ReadPropertiesFile(Concat(GetWCPath(), #APP_INI_FILENAME, #DYNAMIC_INI_EXT)); Name = GetINIProperty(Properties\Sections["Application"], "Name");