-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVexaSort.ahk
More file actions
125 lines (92 loc) · 2.71 KB
/
VexaSort.ahk
File metadata and controls
125 lines (92 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#Requires AutoHotkey v2.0
dim := [256,128]
imgM := Map(), imgM.Default := false
for str in ["ani","bmp","cur","emf","exif","gif","ico","jpg","png","tif","wmf"]
imgM[str] := true
SplitPath A_ScriptName,,,,&noext
SplitPath Trim(FileRead(noext ".cfg")," `t`r`n"), &path2, &path1
srcA := [path1 "\", path2]
vexGui := Gui(, "VexaSort")
vexGui.OnEvent("DropFiles", loadFile)
openSrc(*) => Run("explore " srcA[1] srcA[2])
vexGui.AddButton("w" dim[1], "Open").OnEvent("Click", openSrc)
cBox := vexGui.AddListBox("ReadOnly HScroll" 2*dim[1] " r4 w" dim[1])
loop files srcA[1] "*", "R" {
if imgM[A_LoopFileExt] {
cPic := vexGui.AddPicture("Hidden w-1 h" dim[2], A_LoopFilePath)
break
}}
levels := 0
loop files srcA[1] "*", "DR" {
StrReplace A_LoopFilePath, "\",,, &cnt
levels := Max(cnt, levels)
}
StrReplace srcA[1], "\",,, &cnt
levels -= (--cnt)
drops := []
loop levels {
drops.Push(this := vexGui.AddDDL("Sort w" dim[1]))
this.OnEvent("Change", UpdateDDL.Bind(A_Index))
}
vexGui.AddButton("w" dim[1], "Hard Link") ; .OnEvent("Click", )
vexGui.Show("w" 2*vexGui.MarginX + dim[1])
UpdateDDL(0)
test := vexGui.Submit(0)
OutputDebug PathDDL()
LoadFile(guiL, c, fileA, *){
cBox.Delete()
cPic.Visible := false
for fil in fileA {
SplitPath fil,,,&ext
if imgM[ext] {
cPic.Value := fil
cPic.Visible := true
break
}}
if !cPic.Visible {
for fil in fileA {
loop files fil "\*" {
if imgM[A_LoopFileExt] {
cPic.Value := A_LoopFilePath
cPic.Visible := true
break 2
}}}}
for fil in fileA {
if InStr(FileGetAttrib(fil), "D") {
loop files fil "\*", "DF"
fileA.Push(A_LoopFilePath)
fileA.Delete(A_Index)
}}
while A_Index <= fileA.Length {
if !fileA.Has(A_Index)
fileA.RemoveAt(A_Index--)
}
for fil in fileA {
fileA[A_Index] := StrReplace(fil, srcA[1],,,,1)
}
cBox.Add(fileA)
}
UpdateDDL(val,*){
++val
for ddl in drops {
ddl.Visible := (A_Index <= val)
if A_Index = val {
ddl.Delete()
loop files PathDDL() "*", "D" {
if (A_Index > 1) || (A_LoopFileName != srcA[2])
ddl.Add([A_LoopFileName])
}
else
ddl.Visible := false
}
}
}
PathDDL(arr := drops){
out := srcA[1]
for ddl in arr {
if !ddl.Text
break
out .= ddl.Text "\"
}
return out
}