-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBMS Clipboarder.ahk
75 lines (67 loc) · 1.18 KB
/
BMS Clipboarder.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
^d::
CopyNotes()
RunUtility("dist\build\Unmatch\Unmatch.exe")
Return
^m::
InputBox script, Move notes, Enter script (a)[z][s][x][d][c][f][v]
Sleep 200
CutNotes()
RunUtility("dist\build\MoveNotes\MoveNotes.exe """ . script . """")
Return
^b::
CutNotes()
RunUtility("dist\build\BGMize\BGMize.exe")
Return
CopyNotes()
{
_PrepareClipboard("Copy")
}
CutNotes()
{
_PrepareClipboard("Cut")
}
RunUtility(utility)
{
RunWait %comspec% /c %utility% < input.txt > output.txt, , Min
FileRead output, *t output.txt
lines := StrSplit(output, "`n")
status := lines.RemoveAt(1)
message := lines.RemoveAt(1)
If (status = "ok")
{
outClipboard := ""
Loop % lines.MaxIndex()
{
outClipboard .= lines[A_Index] . "`r`n"
}
Clipboard := outClipboard
Sleep 100
Send ^v
}
Else
{
MsgBox bms-clipboarder ERROR %status%: %message%
}
}
_PerformClipboardOperation(mode)
{
If (mode = "Copy")
{
Send ^c
}
If (mode = "Cut")
{
Send ^x
}
}
_PrepareClipboard(mode)
{
Clipboard := "!"
Sleep 100
_PerformClipboardOperation(mode)
While Clipboard == "!"
{
}
FileDelete input.txt
FileAppend %Clipboard%, input.txt, UTF-8-RAW
}