$sFile1='D:\Name1.txt'
$sFile2='D:\Name2.txt'
$sResult=_Same_Lines_2_File($sFile1,$sFile2)
MsgBox(4096,'Переменная $sResult',$sResult)
$sFileSave='C:\out.txt'
_Same_Lines_2_File_SaveFile($sFile1,$sFile2,$sFileSave)
Func _Same_Lines_2_File($sFile1,$sFile2,$iRegistr=1,$sDelim=@CRLF)
Local $oDict=ObjCreate('Scripting.Dictionary'),$aRet=FileReadToArray($sFile1),$k=0,$sText=''
$oDict.RemoveAll
$oDict.CompareMode=$iRegistr
For $i In $aRet
$oDict.Item($i)=-2
Next
$oDict.Item('')=2
$aRet=FileReadToArray($sFile2)
For $i In $aRet
$oDict.Item($i)+=1
If -1=$oDict.Item($i)Then
$sText&=$i&$sDelim
$k+=1
EndIf
Next
Return $k ? SetError(0,$k,StringTrimRight($sText,StringLen($sDelim))):''
EndFunc
Func _Same_Lines_2_File_SaveFile($sFile1,$sFile2,$sFileSave,$iRegistr=1,$sDelim=@CRLF)
Local $oDict=ObjCreate('Scripting.Dictionary'),$aRet=FileReadToArray($sFile1),$k=0,$sText=''
$oDict.RemoveAll
$oDict.CompareMode=$iRegistr
For $i In $aRet
$oDict.Item($i)=-2
Next
$oDict.Item('')=2
$aRet=FileReadToArray($sFile2)
For $i In $aRet
$oDict.Item($i)+=1
If -1=$oDict.Item($i)Then
$sText&=$i&$sDelim
$k+=1
EndIf
Next
$hFile=FileOpen($sFileSave,138) ; 128+8+2
FileWrite($hFile,$sText)
FileClose($hFile)
EndFunc