SaveSettings

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

[AppName]

KeyName = String

.

.

.

Syntax

Rhino.SaveSettings (strFilename [, strAppName [, strKeyName [, strString]]])

Parameters

strFilename

Required.  String.  The name of the initialization file.  If strFilename contains a full path and file name and the file does not exist, then a new file will be created. The specified directory must already exist.  If strFilename does not contain a full path and file name for the file, then the Windows directory is searched.  If the file does not exist, this function creates the file in the Windows directory.

strAppName

Optional.  String.  The name of the section to which the string will be copied.  If the section does not exist, it is created.  The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters.

strKeyName

Optional.  String.  The name of the key to be associated with a string.  If the key does not exist in the specified section, it is created.  If this parameter is omitted, the entire section, including all entries within the section, is deleted.

strString

Optional.  String.  A string to be written to the file.  If this parameter is omitted, the key pointed to by the strKeyName parameter is deleted.

Note, parameters are not case sensitive, so strAppName and strKeyName may be in any combination of uppercase and lowercase characters.  Also, to improve performance, Windows keeps a cached version of the most recently accessed initialization file.  If strFilename is specified and the other parameters are omitted, Windows flushes the cache.  This function always returns False after flushing the cache, regardless of whether the flush succeeds or fails.

Returns

Boolean

True or False indicating success or failure.

Null

On error.

Example

Rhino.SaveSettings "MySettings.ini"

Rhino.SaveSettings "MySettings.ini", "Section1"

Rhino.SaveSettings "MySettings.ini", "Section2", "Entry1"

Rhino.SaveSettings "MySettings.ini", "Section3, "Entry2", "String1"

Also See

GetSettings