Skip to content

Commit 5caad3f

Browse files
committed
ExplorerDiff: new module
1 parent 5516585 commit 5caad3f

2 files changed

Lines changed: 98 additions & 0 deletions

File tree

ExplorerDiff/ExplorerDiff.ahk

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
; ExplorerDiff - ExplorerDiff.ahk
2+
; author: teric
3+
; created: 2022 2 2
4+
5+
ExplorerDiff() {
6+
files := explorer_get_selected()
7+
8+
if (!files.Length()) {
9+
a2tip("ExplorerDiff: Nothing selected!")
10+
return
11+
} else if (files.Length() != 2) {
12+
MsgBox, Please select 2 files exactly!
13+
}
14+
15+
if !FileExist(ExplorerDiff_Path) {
16+
if (ExplorerDiff_Path == "")
17+
MsgBox, No Diff app set! Please open the dialog and set one!
18+
else
19+
MsgBox, Unable to find set diff app! The path seems to be invalid!`n`n %ExplorerDiff_Path%`n??
20+
Return
21+
}
22+
23+
file1 := files[1], file2 := files[2]
24+
size1 := FileGetSize(file1), size2 := FileGetSize(file2)
25+
26+
if (size1 == size2) {
27+
identical := true
28+
Loop
29+
{
30+
FileReadLine, line1, %file1%, %A_Index%
31+
FileReadLine, line2, %file2%, %A_Index%
32+
if ErrorLevel
33+
break
34+
if (line1 != line2) {
35+
identical := false
36+
Break
37+
}
38+
}
39+
if (identical) {
40+
a2tip("ExplorerDiff: Files are identical!")
41+
Return
42+
}
43+
} else
44+
a2tip("ExplorerDiff: Sizes different ... (" size1 "/" size2 ")")
45+
46+
cmd := """" ExplorerDiff_Path """ """ files[1] """ """ files[2] """"
47+
Run(cmd)
48+
}

ExplorerDiff/a2module.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[
2+
{
3+
"author": "eric",
4+
"date": "2022 2 2",
5+
"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.",
6+
"display_name": "",
7+
"tags": [
8+
"file",
9+
"code",
10+
"wip"
11+
],
12+
"typ": "nfo",
13+
"url": "",
14+
"version": "0.1"
15+
},
16+
{
17+
"disablable": true,
18+
"enabled": true,
19+
"functionCode": "ExplorerDiff()",
20+
"functionMode": 0,
21+
"key": [
22+
"Ctrl+D"
23+
],
24+
"keyChange": true,
25+
"label": "Diff selected files",
26+
"multiple": true,
27+
"name": "ExplorerDiff_Hotkey",
28+
"scope": [
29+
"ahk_class CabinetWClass",
30+
"ahk_class #32770"
31+
],
32+
"scopeChange": true,
33+
"scopeMode": 1,
34+
"typ": "hotkey"
35+
},
36+
{
37+
"file": "ExplorerDiff.ahk",
38+
"typ": "include"
39+
},
40+
{
41+
"browse_type": 1,
42+
"file_types": "Executable (*.exe)",
43+
"label": "Diff application path",
44+
"name": "ExplorerDiff_Path",
45+
"save_mode": false,
46+
"typ": "path",
47+
"value": ".",
48+
"writable": false
49+
}
50+
]

0 commit comments

Comments
 (0)