找回密码
 加入
搜索
查看: 1782|回复: 2

[AU3基础] ini比较多个关键字,显示不相同的字串,請帮帮我[已解决]

[复制链接]
发表于 2015-9-7 00:05:51 | 显示全部楼层 |阅读模式
本帖最后由 ticket 于 2015-9-7 11:11 编辑

各个请帮帮我~~~,谢谢~
找文和测试都没成功
要如何编写!!

myfile.ini的内容:
[MAC]
00-1E-8C-10-F6-7F=ON
00-22-AA-C9-5B-26=ON
00-08-9B-BE-33-A9=ON
00-40-01-30-B5-DD=ON
[MAC1]
00-1E-8C-10-F6-7F=ON
00-22-AA-C9-5B-26=ON
00-40-01-30-B5-DD=ON
比较后结果是:
00-08-9B-BE-33-A9=ON


如下的思路对吗?
A1[2]比较[B1,B2,B3]
A2[2]比较[B1,B2,B3]
A3[2]比较[B1,B2,B3]
A4[2]比较[B1,B2,B3]


        $MAC=IniReadSection(@ScriptDir & "\myfile.ini",  "mac" )
                 $game1= $MAC[1][0]
                 
While 1
        $MAC1=IniReadSection(@ScriptDir & "\myfile.ini",  "mac1" )         
                 For $x=1 To $MAC1[0][0]
                         $game2= $MAC1[$x][0]
                        ;MsgBox(0,"",$MAC1[$x][0])
                  
        Dim $_tmp=StringSplit($game2,"")
                
        For $x=1 To $_tmp[0]
        If $_tmp[$x]="" Then ContinueLoop
        $game1a=StringReplace($game1,$_tmp[$x],"")
        Next
        MsgBox(0,"",$game1a)
                  
        Next
                 
WEnd
发表于 2015-9-7 09:19:10 | 显示全部楼层
应该是找出具有“唯一性”的关键字行吧,所以干脆每行关键字都比较一下才对。
Local $sRe = ''
Local $Ini = @ScriptDir & "\myfile.ini"
Local $sText = FileRead($Ini)
_get_ini_unique_str()
MsgBox(0, '', $sRe)

Func _get_ini_unique_str()
        Local $sSN = 'mac'
        Local $iC = 0
        While 1
       Local $MAC=IniReadSection($Ini,  $sSN)
       If @error Then ExitLoop
       For $i = 1 To $MAC[0][0]
              Local $sTmp = $MAC[$i][0] & '=' & $MAC[$i][1]
              StringReplace($sText, $sTmp, '')
              If @extended < 2 Then $sRe &= $sTmp & @CRLF
          Next
          $iC += 1
          $sSN &= $iC
  WEnd
EndFunc  
 楼主| 发表于 2015-9-7 11:10:05 | 显示全部楼层
本帖最后由 ticket 于 2015-9-7 11:21 编辑

可以了,谢谢你的指敎,没想到也可以用这种方式
Local $sTmp = $MAC[$i][0] & '=' & $MAC[$i][1]
StringReplace($sText, $sTmp, '')
学到了,
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-28 20:13 , Processed in 0.100953 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表