-
Notifications
You must be signed in to change notification settings - Fork 0
/
key-remapping.ahk
187 lines (150 loc) · 5.15 KB
/
key-remapping.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
185
186
187
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
!`::
Send, {Backspace}
return
!Esc::
Send, {Enter}
; convert to lower ;
^#l::
Convert_Lower()
RETURN
; convert to upper case
^#u::
Convert_Upper()
RETURN
; convert to capitalized case
^#k::
Convert_Cap()
RETURN
::qc::Quick call?
::mvn::mvn clean install -DskipTests
; Windows Key + P (Not working)
<#p::switchToPostman()
; Windows Key + V (Not working)
<#v::switchToVSCode()
; Windows Key + C
<#c::switchToChrome()
; Windows Key + I
<#i::switchToIntellij()
; Windows Key + S
<#s::switchToSlack()
; Windows Key + T
<#t::switchToTiddlyWiki()
; Windows Key + Z
<#z::switchToZoom()
; Windows Key + F
<#f::switchToFirefox()
; Windows Key + X
<#X::switchToWindowsTerminal()
switchToIntellij()
{
IfWinNotExist, ahk_exe idea64.exe
Run, idea64.exe
if WinActive("ahk_exe idea64.exe")
Sendinput ^{tab}
else
WinActivate ahk_class SunAwtFrame
}
switchToTiddlyWiki()
{
IfWinNotExist, ahk_exe nw.exe
Run, nw.exe
WinActivate ahk_exe nw.exe
}
switchToSlack()
{
IfWinNotExist, ahk_exe slack.exe
Run, slack.exe
WinActivate ahk_exe slack.exe
}
switchToChrome()
{
IfWinNotExist, ahk_exe chrome.exe
Run, chrome.exe
if WinActive("ahk_exe chrome.exe")
Sendinput ^{tab}
else
WinActivate ahk_exe chrome.exe
}
switchToZoom()
{
IfWinNotExist, ahk_exe Zoom.exe
Run, Zoom.exe
WinActivate ahk_class ZPContentViewWndClass
}
switchToFirefox()
{
IfWinNotExist, ahk_class MozillaWindowClass
Run, firefox.exe
if WinActive("ahk_exe firefox.exe")
{
WinGetClass, class, A
if (class = "Mozillawindowclass1")
msgbox, this is a notification
}
if WinActive("ahk_exe firefox.exe")
Send ^{tab}
else
{
;WinRestore ahk_exe firefox.exe
WinActivatebottom ahk_exe firefox.exe
;sometimes winactivate is not enough. the window is brought to the foreground, but not put into FOCUS.
;the below code should fix that.
WinGet, hWnd, ID, ahk_class MozillaWindowClass
DllCall("SetForegroundWindow", UInt, hWnd)
}
}
switchToVSCode()
{
IfWinNotExist, ahk_exe Code.exe
Run, Code.exe
WinActivate ahk_class Chrome_WidgetWin_1
}
switchToWindowsTerminal()
{
IfWinNotExist, ahk_exe WindowsTerminal.exe
Run, WindowsTerminal.exe
WinActivate ahk_class CASCADIA_HOSTING_WINDOW_CLASS
}
switchToPostman()
{
IfWinNotExist, ahk_exe Postman.exe
Run, Postman.exe
WinActivate ahk_class Chrome_WidgetWin_1
}
Convert_Lower()
{
Clip_Save:= ClipboardAll ; save original contents of clipboard
Clipboard:= "" ; empty clipboard
Send ^c{delete} ; copy highlighted text to clipboard
StringLower Clipboard, Clipboard ; convert clipboard to desired case
Send %Clipboard% ; send desired text
Len:= Strlen(Clipboard)
Send +{left %Len%} ; highlight text
Clipboard:= Clip_Save ; restore clipboard
}
Convert_Upper()
{
Clip_Save:= ClipboardAll ; save original contents of clipboard
Clipboard:= "" ; empty clipboard
Send ^c{delete} ; copy highlighted text to clipboard
StringLower Clipboard, Clipboard ; convert clipboard to desired case
Send %Clipboard% ; send desired text
Len:= Strlen(Clipboard)
Send +{left %Len%} ; highlight text
Clipboard:= Clip_Save ; restore clipboard
}
Convert_Cap()
{
Clip_Save:= ClipboardAll ; save original contents of clipboard
Clipboard:= "" ; empty clipboard
Send ^c{delete} ; copy highlighted text to clipboard
StringLower Clipboard, Clipboard ; convert clipboard to desired case
Send %Clipboard% ; send desired text
Len:= Strlen(Clipboard)
Send +{left %Len%} ; highlight text
Clipboard:= Clip_Save ; restore clipboard
}