-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmdm_import.ahk
97 lines (77 loc) · 2.66 KB
/
mdm_import.ahk
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
Folder := A_ScriptDir "\Custom_Albums"
Import := A_InitialWorkingDir
Unzip := Explorer_GetSelection()
if (Import = Folder)
{
if Unzip not contains `n
{
charttemp := A_Temp "\mdm_" A_NowUTC
chartzip := A_Temp "\mdm_" A_NowUTC "\_mdm-file.zip"
FileCreateDir, %charttemp%
FileCopy, %Unzip%, %chartzip%
Run PowerShell.exe -NoExit -Command Expand-Archive -LiteralPath '%chartzip%' -DestinationPath %charttemp%,, Hide
OpenOrActivateFolder(charttemp)
ExitApp
}
else
{
ExitApp
}
}
else if (Import " " = "C:\WINDOWS\System32 ")
{
ExitApp
}
else if !FileExist(Folder)
{
MsgBox SOMETHING SEEMS OUT OF PLACE!`nYou can try to fix it this way:`n`n1) Put the file inside the same folder where "MuseDash.exe" is.`n2) Right click on any ".mdm" file and click on "Select another program".`n3) Select "mdmc.exe" and that's it!
ExitApp
}
else
{
FileAppend, [%A_YYYY%/%A_MM%/%A_DD% %A_Hour%:%A_Min%:%A_Sec%.%A_MSec%]: File(s) detected at %A_InitialWorkingDir%:`n, %A_ScriptDir%\MelonLoader\mdm_import.log
Loop Files, %A_InitialWorkingDir%\*.mdm, R
{
WriteFile := A_ScriptDir "\Custom_Albums\" A_LoopFileName
if FileExist(WriteFile)
{
FileAppend, | - %A_LoopFileName% [REPLACED]`n, %A_ScriptDir%\MelonLoader\mdm_import.log
FileMove, %A_InitialWorkingDir%\%A_LoopFileName%, %A_ScriptDir%\Custom_Albums, 1
}
else
{
FileAppend, | - %A_LoopFileName% `n, %A_ScriptDir%\MelonLoader\mdm_import.log
FileMove, %A_InitialWorkingDir%\%A_LoopFileName%, %A_ScriptDir%\Custom_Albums, 1
}
}
ExitApp
}
return
Explorer_GetSelection() {
WinGetClass, winClass, % "ahk_id" . hWnd := WinExist("A")
if !(winClass ~= "^(Progman|WorkerW|(Cabinet|Explore)WClass)$")
Return
shellWindows := ComObjCreate("Shell.Application").Windows
if (winClass ~= "Progman|WorkerW") ;
;
shellFolderView := shellWindows.Item( ComObject(VT_UI4 := 0x13, SWC_DESKTOP := 0x8) ).Document
else {
for window in shellWindows ;
if (hWnd = window.HWND) && (shellFolderView := window.Document)
break
}
for item in shellFolderView.SelectedItems
result .= (result = "" ? "" : "`n") . item.Path
;~ if !result
;~ result := shellFolderView.Folder.Self.Path
Return result
}
OpenOrActivateFolder(folderPath) {
for Window in ComObjCreate("Shell.Application").Windows
continue
until Window.document.Folder.Self.Path = folderPath && hWnd := Window.hwnd
if hWnd
WinActivate, ahk_id %hWnd%
else
Run, % folderPath
}