Skip to content

Commit

Permalink
ExplorerDiff: new module
Browse files Browse the repository at this point in the history
  • Loading branch information
ewerybody committed Jun 14, 2022
1 parent 5516585 commit 5caad3f
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
48 changes: 48 additions & 0 deletions ExplorerDiff/ExplorerDiff.ahk
Original file line number Diff line number Diff line change
@@ -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)
}
50 changes: 50 additions & 0 deletions ExplorerDiff/a2module.json
Original file line number Diff line number Diff line change
@@ -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
}
]

0 comments on commit 5caad3f

Please sign in to comment.