-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilities.ahk
184 lines (161 loc) · 2.63 KB
/
utilities.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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#SingleInstance Force
SendMode "Input"
SetWorkingDir A_ScriptDir
OpenObsidian() {
SetTitleMatchMode 2
If WinExist("- Vault -")
WinActivate
else
Run "C:\Users\anon\AppData\Local\Programs\obsidian\Obsidian.exe"
Sleep 3000
WinActivate("- Vault -")
Sleep 150
Send "^+d"
Sleep 150
Send "^{End}"
Send "{Enter}"
return
}
CopyTextToObsidian() {
A_Clipboard := ""
Send "^c"
ClipWait
OpenObsidian
Send "^v"
return
}
OpenTg() {
SetTitleMatchMode 2
If WinExist("Telegram")
WinActivate
else
Run "D:\Users\qrioz\AppData\Roaming\Telegram Desktop\Telegram.exe"
Sleep 3000
WinActivate("Telegram")
return
}
CopyTextToTgSaved() {
A_Clipboard := ""
Send "^c"
ClipWait
OpenTg
Send "^0"
Sleep 150
Send "^v"
Send "{Enter}"
return
}
; Downloading selected youtube link with savefrom web interface
; TODO: think about automating further with pressing download and saving file
^!y:: {
A_Clipboard := ""
Send "^l"
Send "^c"
ClipWait
url := StrReplace(A_Clipboard, "youtube", "ssyoutube")
;url := StrReplace(A_Clipboard, "https://www.youtube.com/watch?v=", "https://www.y2mate.com/youtube/")
Run url
return
}
; Bookmark a web page to obsidian from the page
^!u:: {
A_Clipboard := ""
Send "^l"
Send "^c"
ClipWait
OpenObsidian
Send "[Link]()"
Send "{Left}"
Send "^v"
Send "{End}"
Send "{Space}"
Send "{Raw}#"
Send "link"
return
}
; Sending selected text to an opened Obsidian vault
!o:: {
CopyTextToObsidian
}
#o:: {
OpenObsidian
}
#t:: {
OpenTg
}
;^!s:: {
; CopyTextToTgSaved
;}
; Temporary function for searching a reference document
^7:: {
A_Clipboard := ""
Send "^c"
ClipWait
SetTitleMatchMode 2
If WinExist("---for reference---") {
WinActivate
Sleep 150
Send "^f"
Sleep 1000
Send "^v"
Send "{Enter}"
}
else {
}
return
}
; Use F3 for Shift+F3 (change case in word)
F3:: {
Send "+{F3}"
return
}
; AutoHotkey Media Keys
; >^>Space::Send "{Media_Play_Pause}"
>^>Left:: Send "{Media_Prev}"
>^>Right:: Send "{Media_Next}"
; >^>Up::Send "{Volume_Up}"
; >^>Down::Send "{Volume_Down}"
>^>M:: Send "{Volume_Mute}"
; Enclose in quotes
^':: {
Send "^c"
Send Chr(34)
Send "^v"
Send Chr(34)
}
; Enclose in parens
^9:: {
Send "^c"
Send "("
Send "^v"
Send ")"
}
; Enclose in brackets
![:: {
Send "^c"
Send "["
Send "^v"
Send "]"
}
; Kill MS Word
^!w:: ProcessClose "winword.exe"
^-:: {
Send "–"
}
; Open Windows Terminal
!Enter:: {
Run "wt.exe"
}
ScrollLock:: {
if GetKeyState("CapsLock", "T") {
SetCapsLockState "Off"
} else {
SetCapsLockState "On"
}
}
CapsLock:: {
Send "{LAlt down}{Shift down}"
Send "{LAlt up}{Shift up}"
}
; Open notepad
!n::Run "notepad.exe d:\Vault\Scratchpad\scratch.txt"