dk0521 发表于 2008-8-15 17:21:12

如何修改ini 时 都+1

IniWrite("Auto.ini","SN", "1", "A1")
请问怎么 每次修改 A1时候都+1

auto.ini

1=A1
修改时变成
1=A2

[ 本帖最后由 dk0521 于 2008-8-19 20:55 编辑 ]

jhwl 发表于 2008-8-15 19:22:26

$var = IniReadSection("Auto.ini", "SN")
If @error Then
    MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
Else
    For $i = 1 To $var
Next
EndIf
$n = $var[$var]
$data = StringReplace($n, "A", "")+1
;MsgBox(4096, "", $data)
$data = "A"&$data
FileWriteLine ( "Auto.ini", "1="&$data@CRLF )
auto.ini

1=A1
1=A2
1=A3
1=A4
如果单行值加用下面方法

[ 本帖最后由 jhwl 于 2008-8-25 11:13 编辑 ]

pcbar 发表于 2008-8-15 21:31:48

$var = IniRead("Auto.ini", "SN","1","err")
If $var='err' Then
    MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
        Exit
EndIf
$tmp=StringRegExp($var,"(?<=A)\d+",2)
if IsArray($tmp) then IniWrite("auto.ini","sn","1",'A'&string($tmp+1))
页: [1]
查看完整版本: 如何修改ini 时 都+1