GetSettings

Returns a string from a specified section in a Windows-style initialization file.  The initialization file must have the following form:

[AppName]

KeyName = String

.

.

.

Syntax

Rhino.GetSettings (strFilename [, strAppName [, strKeyName]])

Parameters

strFilename

Required.  String.  The name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.

strAppName

Optional.  String.  The name of the section containing the key name.  If omitted, all section names in the file are returned.

strKeyName

Optional.  String.  The name of the key whose associated string is to be retrieved.  If omitted, all key names in the section specified by strAppName are returned.

Note, parameters are not case sensitive, so strAppName and strKeyName may be in any combination of uppercase and lowercase characters.

Returns

Array

If strAppName is not specified, an array containing all section names in the file if successful.

Array

If strKeyName is not specified, an array containing all key names in the section specified by strAppName if successful.

String

If strAppName and strKeyName are specified, the value of strKeyName if successful.

Null

If not successful, or on error.

Example

Dim strFilename, arrSections, strSection, arrEntries, strEntry, strValue

strFilename = Rhino.OpenFileName("Open", "Initialization Files (*.ini)|*.ini||")

If Not IsNull(strFilename) Then

arrSections = Rhino.GetSettings(strFilename)

If IsArray(arrSections) Then

strSection = Rhino.ListBox(arrSections, "Select a section", strFilename)

If Not IsNull(strSection) Then

arrEntries = Rhino.GetSettings(strFilename, strSection)

If IsArray(arrEntries) Then

strEntry = Rhino.ListBox(arrEntries, "Select an entry", strSection)

If Not IsNull(strEntry) Then

strValue = Rhino.GetSettings(strFilename, strSection, strEntry)

If Not IsNull(strValue) Then

MsgBox strValue, 0, strEntry

End If

End If

End If

End If

End If

End If

Also See

SaveSettings