-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkeys.ahk
More file actions
235 lines (218 loc) · 5.21 KB
/
keys.ahk
File metadata and controls
235 lines (218 loc) · 5.21 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
DetectHiddenWindows,On
; ---------------------------------
; Ctrl+Alt+W 快捷打开网易云音乐
^!w::
Process,Exist,cloudmusic.exe
if (%ErrorLevel% == 0){
Run "C:\Program Files (x86)\Netease\CloudMusic\cloudmusic.exe"
WinWait,ahk_class DesktopLyrics
WinMove,,,,A_ScreenHeight-64
}
else
{
Run, taskkill /PID %ErrorLevel% /F,,Hide
Sleep, 500
CoordMode,Pixel,Screen
CoordMode,Mouse,Screen
MouseGetPos, MX, MY
WinGetPos, Task_X, Task_Y, Task_W, Task_H, ahk_class Shell_TrayWnd
ImageSearch, X, Y, Task_X, Task_Y/3, A_ScreenWidth, A_ScreenHeight, cloud_music_icon.bmp
MouseMove, X, Y
MouseMove, MX, MY
CoordMode,Pixel,Relative
CoordMode,Mouse,Relative
}
return
old_win_class =
$!d::
Process,Exist,cloudmusic.exe
if (%ErrorLevel% != 0){
if WinActive("ahk_class OrpheusBrowserHost"){
WinHide,ahk_class OrpheusBrowserHost
WinActivate, ahk_class %old_win_class%
}else{
WinGetActiveTitle, old_win_title
WinGetClass, old_win_class, A
WinShow,ahk_class OrpheusBrowserHost
WinActivate,ahk_class OrpheusBrowserHost
}
}else{
Send !d
}
return
; ---------------------------------------------
; Ctrl+Alt+Q 快捷打开QQ,如果QQ已在运行,则退出
^!q::
Process,Exist,TIM.exe
if (%ErrorLevel% == 0){
Run "C:\Program Files (x86)\Tencent\TIM\Bin\QQScLauncher.exe"
}else{
Run, taskkill /PID %ErrorLevel% /F,,Hide
Sleep, 500
CoordMode,Pixel,Screen
CoordMode,Mouse,Screen
MouseGetPos, MX, MY
WinGetPos, Task_X, Task_Y, Task_W, Task_H, ahk_class Shell_TrayWnd
Loop, tim_icon\*.bmp
{
ImageSearch, X, Y, Task_X, Task_Y/3, A_ScreenWidth, A_ScreenHeight, %A_LoopFileFullPath%
if(%ErrorLevel% == 0){
break
}
}
MouseMove, X, Y
MouseMove, MX, MY
CoordMode,Pixel,Relative
CoordMode,Mouse,Relative
}
return
; --------------------------------------------------------------
; Ctrl+Shift+T 在当前目录打开cmder(支持SublimeText和资源管理器)
$^+t::
Process,Exist,explorer.exe
if (%ErrorLevel% != 0){
if WinActive("ahk_class CabinetWClass"){
path := getExplorerPath()
Run ,cmder "%path%"
return
}
if WinActive("ahk_class WorkerW"){
Run ,cmder %A_Desktop%
return
}
}
Process,Exist,sublime_text.exe
if (%ErrorLevel% != 0){
if WinActive("ahk_class PX_WINDOW_CLASS"){
WinGetTitle, title, ahk_class PX_WINDOW_CLASS
StringGetPos,pos,title,\,r
StringLeft, folder, title, %pos%
Run ,cmder "%folder%"
return
}
}
Process,Exist,studio64.exe
if (%ErrorLevel% != 0){
if WinActive("ahk_class SunAwtFrame"){
WinGetTitle, title, ahk_class SunAwtFrame
StringGetPos,pos1,title,],l
StringLeft, folder, title, %pos1%
StringGetPos,pos2,folder,[,l
StringRight, folder, folder, pos1-pos2-1
Run ,cmder " %folder% "
return
}
}
Process,Exist,webstorm.exe
if (%ErrorLevel% != 0){
if WinActive("ahk_class SunAwtFrame"){
WinGetTitle, title, ahk_class SunAwtFrame
StringGetPos,pos1,title,],l
StringLeft, folder, title, %pos1%
StringGetPos,pos2,folder,[,l
StringRight, folder, folder, pos1-pos2-1
Run ,cmder " %folder% "
return
}
}
Send ^+t
return
; --------------------------------------------
; Ctrl+Shift+Y 在资源管理器中打开当前目录
^+y::
Process,Exist,sublime_text.exe
if (%ErrorLevel% != 0){
if WinActive("ahk_class PX_WINDOW_CLASS"){
WinGetTitle, title, ahk_class PX_WINDOW_CLASS
SearchText = \
StringGetPos,pos,title,%SearchText%,r
StringLeft, path, title, %pos%
IfWinExist, ahk_class CabinetWClass, %path%
{
WinActivate
}else{
Run ,explorer %path%
}
return
}
}
if (WinActive("ahk_class SunAwtFrame")){
WinGetTitle, title
SearchText = ]
StringGetPos,lpos,title,%SearchText%,l
StringLeft, title, title, %lpos%
split = [
StringSplit, titles,title, %split%
path = %titles2%
IfWinExist, ahk_class CabinetWClass, %path%
{
WinActivate
}else{
Run ,explorer %path%
}
}
return
getExplorerPath(){
IfWinExist, ahk_class CabinetWClass
{
ControlGetText,address,ToolbarWindow323,ahk_class CabinetWClass
StringLen, length, address
StringRight, path, address, length-4
return path
}
return
}
; Ctrl+BackSpace 删除单词
#IF WinActive("ahk_class Notepad")
Ctrl & BackSpace::Send ^+{left}{BackSpace}
#IF
; Shift+Enter 另起新行
Shift & Enter::Send {End}{Enter}
; Ctrl+D 删除一行
$^d::
if (WinActive("ahk_class PX_WINDOW_CLASS")){
send ^l{delete}
return
}
if (WinActive("ahk_class Notepad")
or WinActive("ahk_class ApplicationFrameWindow")
or WinActive("ahk_class Qt5QWindowIcon")){
send {home 2}{Shift down}{end}{right}{Shift up}{delete}
}else{
send, ^d
}
return
; 单击左边的Ctrl键会将剪切板中非文本内容转化为文本,比如文件转化为文件的路径
Ctrl::
Clipboard = %Clipboard%
StringLeft showText,Clipboard,300
showlen := StrLen(showText)
totallen := StrLen(Clipboard)
if(showlen < totallen)
{
showText := showText "`n`n......`n" totallen " more"
}
ToolTip, %showText%
Sleep,1000
tooltip
return
; Alt+C关闭当前窗口
$!c::
if (WinActive("ahk_class Progman") or WinActive("ahk_class WorkerW")){
send {Shift down}{F10 down}vd{F10 up}{Shift up}
}else if(WinActive("ahk_class Chrome_WidgetWin_1")){
send {Ctrl down}w{Ctrl up}
}else{
WinClose,A
}
return
XButton1::
AppsKey::
CoordMode,Mouse,Screen
MouseGetPos,mouseX,mouseY
CoordMode,Mouse,Relative
Run ,pythonw skyutils\main.py %mouseX% %mouseY%
return
^ESC::
Send, ^{vkc0sc029}
Return