diff --git a/ExplorerDiff/ExplorerDiff.ahk b/ExplorerDiff/ExplorerDiff.ahk new file mode 100644 index 0000000..fb5831e --- /dev/null +++ b/ExplorerDiff/ExplorerDiff.ahk @@ -0,0 +1,48 @@ +; ExplorerDiff - ExplorerDiff.ahk +; author: teric +; created: 2022 2 2 + +ExplorerDiff() { + files := explorer_get_selected() + + if (!files.Length()) { + a2tip("ExplorerDiff: Nothing selected!") + return + } else if (files.Length() != 2) { + MsgBox, Please select 2 files exactly! + } + + if !FileExist(ExplorerDiff_Path) { + if (ExplorerDiff_Path == "") + MsgBox, No Diff app set! Please open the dialog and set one! + else + MsgBox, Unable to find set diff app! The path seems to be invalid!`n`n %ExplorerDiff_Path%`n?? + Return + } + + file1 := files[1], file2 := files[2] + size1 := FileGetSize(file1), size2 := FileGetSize(file2) + + if (size1 == size2) { + identical := true + Loop + { + FileReadLine, line1, %file1%, %A_Index% + FileReadLine, line2, %file2%, %A_Index% + if ErrorLevel + break + if (line1 != line2) { + identical := false + Break + } + } + if (identical) { + a2tip("ExplorerDiff: Files are identical!") + Return + } + } else + a2tip("ExplorerDiff: Sizes different ... (" size1 "/" size2 ")") + + cmd := """" ExplorerDiff_Path """ """ files[1] """ """ files[2] """" + Run(cmd) +} diff --git a/ExplorerDiff/a2module.json b/ExplorerDiff/a2module.json new file mode 100644 index 0000000..cd03871 --- /dev/null +++ b/ExplorerDiff/a2module.json @@ -0,0 +1,50 @@ +[ + { + "author": "eric", + "date": "2022 2 2", + "description": "Easier file diffing in the Windows Explorer.\nSelect 2 files, Ctrl+D: tell if files are identical already without opening your diff tool. Select one file in Explorer, have another selected in another Explorer window: Offer to diff these right away.", + "display_name": "", + "tags": [ + "file", + "code", + "wip" + ], + "typ": "nfo", + "url": "", + "version": "0.1" + }, + { + "disablable": true, + "enabled": true, + "functionCode": "ExplorerDiff()", + "functionMode": 0, + "key": [ + "Ctrl+D" + ], + "keyChange": true, + "label": "Diff selected files", + "multiple": true, + "name": "ExplorerDiff_Hotkey", + "scope": [ + "ahk_class CabinetWClass", + "ahk_class #32770" + ], + "scopeChange": true, + "scopeMode": 1, + "typ": "hotkey" + }, + { + "file": "ExplorerDiff.ahk", + "typ": "include" + }, + { + "browse_type": 1, + "file_types": "Executable (*.exe)", + "label": "Diff application path", + "name": "ExplorerDiff_Path", + "save_mode": false, + "typ": "path", + "value": ".", + "writable": false + } +] \ No newline at end of file