DataType:iniadvfilesectionkey

From the wonderful RedGuides Wiki

Access keys in an .ini file, whether a specific one or in general.


This Data Type is added by core MacroQuest.
iniadvfilesectionkey is used as a return type by these members:  [ Toggle ]

Page Member Description
iniadvfilesection Key Access members of the key datatype
Key[<name>] Access to a specific key

Members

Type Member Description
bool Exists TRUE if the specified key exists
int Count How many keys exist in the specified index
string KeyAtIndex[<#>] The name of the key at the specified index number.
Value Returns the value for a specific key.
ValueAtIndex[<#>] The value of a key at the specified index number.
Value[index] If the key doesn't exist, will return the given index.

Examples

If sample.ini contains:

[SectionOne]
key1=foo
key2=bar
[SectionTwo]
key1=baz
key3=duplicate
key3=foobar

And you type...

/echo ${Ini.File[sample.ini].Section[SectionTwo].Key.Count}

returns "3"

/echo ${Ini.File[sample.ini].Section[SectionTwo].Key.KeyAtIndex[2]}

returns "key3"

/echo ${Ini.File[sample.ini].Section[SectionTwo].Key.KeyAtIndex[3]}

returns "key3"

/echo ${Ini.File[sample.ini].Section[SectionTwo].Key[key3].ValueAtIndex[2]}

returns "foobar"

/echo ${Ini.File[sample.ini].Section[SectionTwo].Key[key5].Value[nobody home]}

returns "nobody home"

See also