functions
fhGetIniFileValue
Description
Returns the value of a given named value (identified by a 'key') in an Inifile. Inifiles are a standard way of storing setting information and similar data in a text format file, in Windows. The named values are on separate lines, grouped into sections. Section names are on a line of their own, within square brackets. The name for each value is called a 'key', and it is separated from the value of the named value by an equals sign. For example, suppose a text file contained the following text only:
[Report Options]
Header Line Depth=50
This file could be treated as an Inifile (if in an appropriate text format) containing only one named value (50). The key for this value is "Header Line Depth", and it belongs within the section "Report Options".
For more information about Inifiles, see fhSetIniFileValue.
Minimum FH Version
7
Syntax
var= fhGetIniFileValue(strFile, strSection, strKey, strValueType, varDefault)
Parameters
- strFile
- String: the full file name, including path (e.g. "C:\Program Data\Calico Pie\Family Historian\Plugins\New Report.fhr").
- strSection
- String: The section.
- strKey
- String: The key.
- strValueType
- String: This must be "integer", "text" or "bool", depending on the type of the value being returned.
- varDefault
- Variable Type: Can be a text string, an integer or a boolean, depending on the value of strValueType. Is the default value to be returned if the value is not found. If a default value is not supplied, a default value of 0 will be used for an integer, a default value of an empty string will be used for text, and a default value of false will be used for a boolean.
Return Value
- var
- The value returned as a text string, integer or boolean, depending on the value of the strValueType parameter.
Example
strFooterRight = fhGetIniFileValue(strFile, "Report Options", "Footer - Right", "text")