#SingleInstance force #NoTrayIcon #NoEnv SetBatchLines, -1 Gui, +AlwaysOnTop +LastFound Gui, Add, Edit, w500 cGray vPath1, Enter file path #1 here. Gui, Add, Edit, w500 cGray vPath2, Enter file path #2 here. Gui, Add, Button, w50 gGuiSubmit, OK Gui, Add, Button, w50 gGuiClose x+10, Cancel Gui, Font, Bold Gui, Add, Button, gHelp x+10, ? Gui, Font, Norm Gui, Add, Checkbox, x+20 vNoWhite, Ignore white space Gui, Add, Checkbox, x+10 vMismatch, Report mismatches Gui, Add, Checkbox, x+10 vHTML, Output in HTML Gui, Show,,Text Compare GuiControl, Focus, HTML WinGet, WinID, ID SetTimer, Edit return GuiClose: ExitApp Help: Run,http://www.autohotkey.net/~jaco0646/Text Compare Help.html return GuiDropFiles: If A_EventInfo > 2 { Gui, +OwnDialogs MsgBox,48,Text Compare, More than 2 items were dropped. return } If A_EventInfo = 2 Loop,Parse,A_GuiEvent,`n,`r { GuiControl,Font,Path%A_Index% GuiControl,,Path%A_Index%,%A_LoopField% } Else If (A_GuiControl="path1") OR (A_GuiControl="path2") { GuiControl,Font,%A_GuiControl% GuiControl,,%A_GuiControl%,%A_GuiEvent% } return GuiSubmit: SetTimer, Edit, Off Gui,Submit Gui,Destroy Loop,2 { IfNotExist,% path%A_Index% { MsgBox,16,Text Compare,% "The path does not exist:`n" path%A_Index% ExitApp } FileGetAttrib, attribs,% path%A_Index% IfInString, attribs, D { MsgBox,16,Text Compare,% "The path does not specify a file:`n" path%A_Index% ExitApp } StringRight,slash,Path%A_Index%,1 If slash = \ StringTrimRight,Path%A_Index%,Path%A_Index%,1 } Loop { match=0 FileReadLine, line1, %Path1%, %A_Index% Error1 := ErrorLevel FileReadLine, line2, %Path2%, %A_Index% Error2 := ErrorLevel If (Error1) AND (Error2) break If NoWhite { NW1 := RegExReplace(line1,"[`t ]+") NW2 := RegExReplace(line2,"[`t ]+") If (NW1 = NW2) continue If NW1= Error1=1 If NW2= Error2=1 } Else If (line1 = line2) continue If Error1 match+=2 If Error2 match++ If file1= { FileRead, file1, %Path1% FileRead, file2, %Path2% If NoWhite { file1 := RegExReplace(file1,"[`t ]+") file2 := RegExReplace(file2,"[`t ]+") } } If Mismatch { num3=# num4=# } line1copy := NoWhite=1 ? NW1:line1 line2copy := NoWhite=1 ? NW2:line2 If Error2=0 Loop, Parse, file1, `n,`r If (A_LoopField = line2copy) { match++ num4 := A_Index break } If Error1=0 Loop, Parse, file2, `n,`r If (A_LoopField = line1copy) { match+=2 num3 := A_Index break } If (match = 3) AND !(Mismatch) continue If doc= { SplitPath,Path1,,,,NoExt1 SplitPath,Path2,,,,NoExt2 ext := HTML=1 ? ".html":".txt" doc := A_ScriptDir "\" NoExt1 "-vs-" NoExt2 ext If HTML { IfNotExist,%doc% FileAppend, (LTrim