本帖最后由 Mr丶KQ 于 2017-3-18 10:14 编辑
1.txt25315|↓|25311
25429|←|25423
26307|空格|26301
27338|←|27335
27519|→|27513
27951|空格|27946
28961|←|28953
29181|↓|29177
29591|空格|29582
30369|↑|30360
30706|→|30703
30874|→|30874
31238|空格|31231
32055|←|32047
32311|↓|32304
32466|←|32464
32903|空格|32895
33463|↓|33455
33647|↑|33639
33818|↑|33815
;-------------------
2.txt25603|←|25601
25651|↓|25650
26393|空格|26393
27579|←|27578
27635|→|27633
28023|空格|28016
29069|←|29066
29257|↓|29257
29655|空格|29649
30467|↑|30465
30773|→|30770
30947|→|30947
31303|空格|31298
32154|←|32154
32561|←|32561
32561|↓|32561
32959|空格|32954
33535|↓|33530
33705|↑|33705
33921|↑|33921
34592|空格|34584
35178|↑|35178
35612|↓|35610
35639|→|35633
36242|空格|36242
36970|↑|36962
36970|→|36962
37230|↓|37225
37883|空格|37883
38545|↑|38536
;-------------------
1.txt与2.txt对比后要的结果25651|↓|25650
25603|←|25601
26393|空格|26393
27579|←|27578
27635|→|27633
28023|空格|28016
29069|←|29066
29257|↓|29257
29655|空格|29649
30467|↑|30465
30773|→|30770
30947|→|30947
31303|空格|31298
32154|←|32154
32561|↓|32561
32561|←|32561
32959|空格|32954
33535|↓|33530
33705|↑|33705
33921|↑|33921
;-------------------
这是目前有问题的代码:#include <Array.au3>
$TwoToOneFullData1 = _FileRead(@ScriptDir & "\1.txt",0)
$FullEventKeyATMulti = StringRegExp($TwoToOneFullData1,"\V+",3)
$AllEventKeyATMulti = UBound($FullEventKeyATMulti)
$TwoToOneFullData2 = _FileRead(@ScriptDir & "\2.txt",0)
$FullEventKeyBOMulti = StringRegExp($TwoToOneFullData2,"\V+",3)
$AllEventKeyBOMulti = UBound($FullEventKeyBOMulti)
Local $FullKSData[$AllEventKeyATMulti][7]
Local $KSState1,$KSNumber1 = 0,$KSUse1 = ""
For $AT = 0 To $AllEventKeyATMulti - 1
$KSState1 = 0
$EventKeyAT2 = StringSplit($FullEventKeyATMulti[$AT],"|")
$FullKSData[$AT][0] = $AT + 1
$FullKSData[$AT][1] = $EventKeyAT2[1]
$FullKSData[$AT][2] = $EventKeyAT2[2]
$FullKSData[$AT][3] = $EventKeyAT2[3]
For $BO = $KSNumber1 To $AllEventKeyBOMulti - 1
If $KSUse1 <> $FullEventKeyBOMulti[$BO] Then
$EventKeyBO2 = StringSplit($FullEventKeyBOMulti[$BO],"|")
If ($EventKeyBO2[1] - $FullKSData[$AT][1] >= 0) And ($EventKeyBO2[2] = $FullKSData[$AT][2]) And ($EventKeyBO2[3] - $FullKSData[$AT][3] >= 0) Then
$FullKSData[$AT][4] = $EventKeyBO2[1]
$FullKSData[$AT][5] = $EventKeyBO2[2]
$FullKSData[$AT][6] = $EventKeyBO2[3]
$KSState1 = 1
$KSNumber1 += 1
$KSUse1 = $FullEventKeyBOMulti[$BO]
ExitLoop
EndIf
EndIf
Next
If $KSState1 = 0 Then
$FullKSData[$AT][5] = "/"
$FullKSData[$AT][6] = "/"
EndIf
Next
;[1]和[15]中的Col4、5、6 数值不正确
_ArrayDisplay($FullKSData,"")
Exit
Func _FileRead($RcdFile,$Mode = 0)
Local $RcdFileOpen = FileOpen($RcdFile,$Mode)
Local $RcdFileString = String(FileRead($RcdFileOpen))
FileClose($RcdFileOpen)
Return $RcdFileString
EndFunc
|