XIncludeFile #PB_Compiler_Home+"Inc\PureAutoIt.pbi"
UseModule PureAutoIt

Procedure Example()
  ; Create an INI section structure as a string.
  sSection.s = "Title=AutoIt" + #CRLF$ + "Version=" + _PureAutoItVersion() + #CRLF$ + "OS=" + _OSVersion()

  ; Write the string to the sections labelled 'General', 'Version' and 'Other'.
  IniWriteSectionString(_TempDir() + "\Example.ini", "General", sSection)
  IniWriteSectionString(_TempDir() + "\Example.ini", "Version", sSection)
  IniWriteSectionString(_TempDir() + "\Example.ini", "Other", sSection)

  ; Rename the section labelled 'General' to 'System'.
  IniRenameSection(_TempDir() + "\Example.ini", "General", "System")

  ; Read the INI section names. This will return a comma separated string
  sNames.s = IniReadSectionNames(_TempDir() + "\Example.ini")

  ; Check if an error occurred.
  If Not _Error()
    ; Enumerate through the array displaying the section names.
    For i = 1 To CountString(sNames, ",") + 1
      MsgBox(#MB_SYSTEMMODAL, "", "Section: " + StringField(sNames, i, ","))
    Next
  EndIf

  ; Delete the INI file.
  FileDelete(_TempDir() + "\Example.ini")
EndProcedure

Example()
