Returns a string from a specified section in a Windows-style initialization file. The initialization file must have the following form:
[Section]
Entry = String
...
rhinoscriptsyntax.GetSettings(filename, section=None, entry=None)
rhinoscript.utility.GetSettings(filename, section=None, entry=None)
filename |
Required. String. The name of the initialization file. |
section |
Optional. String. The section containing the entry. |
entry |
Optional. String. The entry whose associated string is to be returned. |
Note, parameters are not case sensitive, so section and entry may be in any combination of uppercase and lowercase characters.
List |
If section is not specified, a list containing all section names from filename if successful. |
List |
If entry is not specified, a list containing all entry names within section if successful. |
String |
If section and entry are specified, the value of entry if successful. |
None |
If not successful, or on error. |
import rhinoscriptsyntax as rs
filename = rs.OpenFileName("Open", "Initialization Files (*.ini)|*.ini||")
if filename:
sections = rs.GetSettings(filename)
if sections:
section = rs.ListBox(sections, "Select a section", filename)
if section:
entries = rs.GetSettings(filename, section)
if entries:
entry = rs.ListBox(entries, "Select an entry", section)
if entry
value = rs.GetSettings(filename, section, entry)
if value: rs.MessageBox( value, 0, entry )