Код:
$sFileName = @ScriptDir & '\Test.ini'
$sSectName = 'Prefs'
$iExists = _IniSectionExists($sFileName, $sSectName)
If $iExists Then
MsgBox(262144+64, 'OK!', 'Section [' & $sSectName & '] exists in file <' & $sFileName & '>')
ElseIf $iExists = -1 Then
MsgBox(262144+48, 'Error!', 'File <' & $sFileName & '> was not found')
Else
MsgBox(262144+48, 'Error!', 'There is no section [' & $sSectName & '] in file <' & $sFileName & '>')
EndIf
Func _IniSectionExists($sIniFile, $sSectionName)
If Not FileExists($sIniFile) Then
Return SetError(1, 0, -1)
EndIf
IniReadSection($sIniFile, $sSectionName)
If @error = 1 Then
Return 0
EndIf
Return 1
EndFunc