-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAHK_new.ahk
166 lines (154 loc) · 3.13 KB
/
AHK_new.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
#NoEnv
SendMode Input
GroupAdd, browser, ahk_exe firefox.exe
GroupAdd, browser, ahk_exe chrome.exe
GroupAdd, browser, ahk_exe opera.exe
;reload and exit this script
~+!x::ExitApp
~!+r::Reload
;Double-click on the middle mouse button to switch Scroll Lock (Scroll Lock is responsible for switching mouse modes)
#UseHook, On
mbutton:: Gosub, PressCount
mbutton(1):
Click Down middle
KeyWait, mbutton
Click Up middle
if GetKeyState("ScrollLock", "T") = 0
{
ToolTip, Copy.
}
else
{
ToolTip, New table.
}
Sleep, 1000
ToolTip
return
mbutton(2):
if GetKeyState("ScrollLock", "T") = 0
ToolTip, New table.
if GetKeyState("ScrollLock", "T") = 1
ToolTip, Copy.
Send {ScrollLock}
Sleep, 1000
ToolTip
return
#UseHook, Off
PressCount:
Pause_=350
if not Second
{
Second=1
SetTimer, DoublePress, -%Pause_%
}
else
{
Second=0
SetTimer, %A_ThisHotkey%(2), -1
}
return
DoublePress:
if not Second
return
Second=0
SetTimer, %A_ThisHotkey%(1), -1
return
;Search in Google selected text (Shift+LAlt+S)
~!+s::
clipboard := "Select the text!"
Send ^c
ClipWait, 1
if WinExist("ahk_group chrome") {
WinActivate
Send ^t
Send ^v
Send {Enter}
}
else {
Run, "C:\Program Files\Google\Chrome\Application\chrome.exe"
WinWaitActive, New Tab - Google Chrome, , 2
Send ^v
Send {Enter}
}
return
;Translate selected text in Yandex (Shift+LAlt+A)
~!+a::
link := "https://translate.yandex.ru/?source_lang=en&target_lang=ru&text="
clipboard := ""
Send ^c
ClipWait, 1
if WinExist("ahk_group chrome") {
WinActivate
Send ^t
Send %link%
Send ^v
Send {Enter}
}
else {
param := "https://translate.yandex.ru/"
chrome := "C:\Program Files\Google\Chrome\Application\chrome.exe"
Run, %chrome% %param%
WinWaitActive, , , 3
Send ^v
Send {Enter}
}
return
;Hotkey for mouse in browser
#ifWinActive, ahk_group browser
$rbutton::
keywait, rbutton, t0.2
if errorlevel
{
rbutton & wheelup:: SendInput ^{pgdn}
return
rbutton & wheeldown:: SendInput ^{pgup}
return
}
else
{
click right
}
return
~lbutton & Volume_Up:: SendInput {lbutton up} ^{home}
return
~lbutton & Volume_down:: SendInput {lbutton up} ^{end}
return
~lbutton & wheelup:: SendInput {lbutton up} {pgup}
return
~lbutton & wheeldown:: SendInput {lbutton up} {pgdn}
return
lbutton & rbutton:: Send ^w
rbutton & lbutton:: Send ^+{click}
rbutton & mbutton:: Send ^{F5}
lbutton & mbutton:: Send ^v {enter}
rbutton & Volume_Up:: SendInput {Browser_Forward}
rbutton & Volume_down:: SendInput {Browser_Back}
Media_Stop & Volume_down:: Send ^#{left}
Media_Stop & Volume_up:: Send ^#{right}
return
;Hotkey for mouse in Notepad++
#ifWinActive, ahk_exe notepad++.exe
$rbutton::
keywait, rbutton, t0.2
if errorlevel
{
rbutton & wheelup:: SendInput ^{pgdn}
return
rbutton & wheeldown:: SendInput ^{pgup}
return
}
else
{
click right
}
;return
lbutton & Volume_Up:: SendInput ^{home}
lbutton & Volume_down:: SendInput ^{end}
lbutton & wheelup:: SendInput {pgup}
lbutton & wheeldown:: SendInput {pgdn}
lbutton & rbutton:: Send ^w
rbutton & mbutton:: Send ^n
mbutton & rbutton:: Send ^w
rbutton & Volume_Up:: Send ^y
rbutton & Volume_down:: Send ^z
return