IniReadSection

From AutoIt Wiki

Jump to: navigation, search

Contents

Description

Reads all keys and values from a section in a standard format .ini file.

Syntax

IniReadSection ("filename", "section")

Parameters

Filename = The name of the .ini file.

Section = The section the key(s) is located in.

Return

Returns a 2 dimensional array, the first result is the total record count. Subsequent records contain the Key and Value data.

$result[0][0] = record count(n)

$result[n][0] = Key

$result[n][1] = Value

Example

;Write simple ini file
IniWrite("FileName.INI", "Section", "Key1", "Value")
IniWrite("FileName.INI", "Section", "Key2", "Value")

;Read INI file
$Var = IniReadSection ("FileName.INI", "Section")

ConsoleWrite("Debug: " & $var[0][0] & @LF) ; Returns record count.

; Send results to SciTE Console
For $i1 = 1 to $var[0][0] ; Loop for record count
  For $i2 = 0 to 1 ; Loop for Key and Value
    ConsoleWrite("Debug: " & $var[$i1][$i2] & @LF)
  Next
Next

Also see:

IniDelete, IniWrite, IniRead, AutoIt Documents[1]

Personal tools