-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaste-into.ahk
92 lines (84 loc) · 2.44 KB
/
paste-into.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
;
; paste-into.ahk
;
#^c:: ; Insert citation into Discord with Win+Ctrl+c
prevClipboard := ClipboardAll
; Put selected text into clipboard
Clipboard =
Send, ^c
ClipWait
KeyWait Control
KeyWait LWin
KeyWait RWin
KeyWait c
if (!ErrorLevel) {
; Activate Discord app
WinActivate, ahk_exe Discord.exe ahk_class Chrome_WidgetWin_1
WinWaitActive, ahk_exe Discord.exe ahk_class Chrome_WidgetWin_1
; Move focus to input control
Send, a
Send, {Backspace}
; Paste text
lines := StrSplit(Clipboard, "`r`n", , 2)
if (lines.Length() > 1) {
pos := InStr(lines[1], "Сегодня в")
if (pos < 1) {
pos := InStr(lines[1], "Today at")
}
if (pos > 0) {
Clipboard := "@" . SubStr(lines[1], 1, pos-1) . "`n"
Send, ^v
Sleep, 100
Clipboard := lines[2]
}
}
Clipboard := "```````n" . Clipboard . "`n```````n"
Send, ^v
Sleep, 100
Clipboard := prevClipboard
}
return
#^e:: ; Insert @everyone into Discord with Win+Ctrl+e
prevClipboard := ClipboardAll
WinActivate, ahk_exe Discord.exe ahk_class Chrome_WidgetWin_1
WinWaitActive, ahk_exe Discord.exe ahk_class Chrome_WidgetWin_1
Clipboard := "@everyone "
Send, ^v
Sleep, 100
Clipboard := prevClipboard
return
#^+c:: ; Insert code into Skype with Win+Ctrl+Shift+c
prevClipboard := ClipboardAll
Clipboard =
Send, ^c
ClipWait
KeyWait Control
KeyWait LWin
KeyWait RWin
KeyWait Shift
KeyWait c
if (!ErrorLevel) {
WinActivate, ahk_exe Skype.exe ahk_class tSkMainForm
WinWaitActive, ahk_exe Skype.exe ahk_class tSkMainForm
ControlFocus, ClassNN, TChatRichEdit1
lines := StrSplit(Clipboard, "`r`n", , 2)
Clipboard := "{code}`n" . Clipboard . "`n{code}`n"
Send, ^v
Sleep, 100
Clipboard := prevClipboard
}
return
^`:: ; Ctrl+` Replace selected text with `text`
prevClipboard := ClipboardAll
Clipboard =
Send, ^x
ClipWait, 0.1
if (!ErrorLevel && StrLen(Clipboard) > 0) {
Clipboard := "``" . Clipboard . "``"
} else {
Clipboard := "``"
}
Send, ^v
Sleep, 100
Clipboard := prevClipboard
return