_IniWrite(@DesktopDir & '\1.txt', 'Key1', 'Key2', 'Key3')
_IniWrite(@DesktopDir & '\1.txt', 'Key1', 'Key2', 'Key3')
_IniWrite(@DesktopDir & '\1.txt', 'Key1', 'Key2', 'Key3')
Func _IniWrite($sFile, $sSect, $sKey, $sVal)
Local $sOldSect, $sOldKey, $sOldVal
Local $aSectNames = IniReadSectionNames($sFile)
For $i = 1 To UBound($aSectNames)-1
If StringRegExp($aSectNames[$i], '(?i)^(' & $sSect & ')*$') Then
IniRenameSection($sFile, $aSectNames[$i], $aSectNames[$i] & $sSect)
$aSect = IniReadSection($sFile, $aSectNames[$i] & $sSect)
For $j = 1 To UBound($aSect)-1
If StringRegExp($aSect[$j][0], '(?i)^(' & $sKey & ')*$') Then
IniDelete($sFile, $aSectNames[$i] & $sSect, $aSect[$j][0])
Return IniWrite($sFile, $aSectNames[$i] & $sSect, $aSect[$j][0] & $sKey, $aSect[$j][1] & $sVal)
EndIf
Next
EndIf
Next
Return IniWrite($sFile, $sSect, $sKey, $sVal)
EndFunc