-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSublimeTab.AHK
438 lines (376 loc) · 9.05 KB
/
SublimeTab.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
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
;#UseHook Off;
;#MaxHotkeysPerInterval 2
;#Persistent
; #Warn ; Enable warnings to assist with detecting common errors.
;SHORTCUTS https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
CoordMode, Mouse, Screen
CapsLock::
Send {tab 1}
Return
#If (!WinActive("Counter-Strike Source") and !WinActive("Synergy") and !WinActive("Counter-Strike:"))
$tab::
;;GetKeyState, aastate, Alt
;;if (aastate = "D"){
;;Return
;;}
;
;;GetKeyState, bbstate, Tab
;;if (bbstate = "U"){
;;if (aastate = "D"){
;;Return
;;}
;;}
;
;GetKeyState, state, Shift
;if (state = "D"){
;Send, {TAB down}{TAB up}
;}
;else{
;Send {Alt down}{Tab down}
;Keywait, Control
;Send {Control down}
;Sleep 300
;Send {Control up}
;Send {Tab up}
;Send {Alt up}
;
;cant works
;Send ^!{tab}
;
;MouseMove, 494,454,0
; Loop{
; getkeystate,escme,Esc, D
; if (escme="D")
; {
; break
; }
; ;getkeystate,escmetoo,RButton, D
; ;if (escmetoo="D")
; ;{
; ; Send,{Esc}
; ; break
; ;}
; getkeystate,aa,Control, D
; getkeystate,bb,LButton, D
; If (aa="D" OR bb="D"){
; if (aa="D"){
; Send, {LButton down}
; Send, {LButton up}
; Sleep,100
; WinGet, active_id, ID, A
; WinShow, ahk_id %active_id%
; WinActivate, ahk_id %active_id%
; WinSet, AlwaysOnTop, ON, ahk_id %active_id%
; Sleep,100
; }
; ;if (acount>=500){
; ; break
; ;}
; ;if (bb="D"){
; ; Send,{Control down}
; ; Send,{Control up}
; ;}
; break
; }
; acount+=1
; if (acount>=1500){
; break
; }
; Sleep 1
; }
;}
Run, "C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk"
MouseMove, 494,454,0
return
#If
²::
Sleep,150
GetKeyState, state, ²
aastate:=GetKeyState("Tab","P")
if (aastate = 1){
;Send,{²}
Return
}
if (state = "D"){
;msgbox % "11"
WinGet, active_id, ID, A
;WinMaximize, ahk_id %active_id%
WinShow, ahk_id %active_id%
WinActivate, ahk_id %active_id%
WinSet, AlwaysOnTop, ON, ahk_id %active_id%
}
else{
WinGet, active_id, ID, A
WinSet, AlwaysOnTop, OFF, ahk_id %active_id%
WinSet, Bottom,,A
}
return
; Below is update for app, easy windows switcher, in fact its ´ but depend what lang
#²::
Send !{ù}
return
$!²::
WinGet, active_id, ID, A
WinSet, AlwaysOnTop, OFF, ahk_id %active_id%
;WinRestore, ahk_id %active_id%
return
;$!*Esc:: return
^Escape:: return
#Esc:: return
;!F4:: return
;*!Esc::
;^v::
;if !WinActive("ahk_class PX_WINDOW_CLASS ahk_exe sublime_text.exe")
;{
; ;msgbox,"dds"
; ;SendInput,^v
; ;Send,^{vk56}
; ;Send,%Clipboard%
; ;Send,^{vk56}
; ;only this below should not alter clipboard content and permit to not add indentation in sublime itself in many langages.
; Send,+{Ins}
; ;Note this could not works as before incertain applications, ex: One commander V2, a pasted clipboard content in a folder does not create a new file named by default with the date.
; Return
;}
;works indentations as expected.
;Send,^+v
;return
:*?:vv::
If WinActive("ahk_class PX_WINDOW_CLASS ahk_exe sublime_text.exe")
{
Send,^+v
}
else
{
;Send,^v
Send,+{Ins}
}
return
;ALL COMMENTS BELOW CAUSE ONLY OF CHROMETABMOUSE GET ITS OWN FUNCTIONNALITIES.
#If WinActive("ahk_exe sublime_text.exe")
+WheelUp::
;oki:=WinActive("ahk_exe sublime_text.exe")
;if (oki)
;{
;ActiveHwnd := WinExist("A")
SendInput,+{WheelDown}
;Sleep,50
;if (oki=ActiveHwnd)
;{
SendInput,+{WheelDown}
;Sleep,50
SendInput,+{WheelDown}
;Sleep,50
SendInput,+{WheelDown}
;}
;}
;else
;{
;SendInput,+{WheelDown}
;}
return
+WheelDown::
;oki:=WinActive("ahk_exe sublime_text.exe")
;if (oki)
;{
;ActiveHwnd := WinExist("A")
SendInput,+{WheelUp}
;if (oki=ActiveHwnd)
;{
;Sleep,50
SendInput,+{WheelUp}
;Sleep,50
SendInput,+{WheelUp}
;Sleep,50
SendInput,+{WheelUp}
;}
;}
;else
;{
;SendInput,+{WheelUp}
;}
return
#If
;This functionnality help to choose a completion popup entry with a single key, instead several up or down followed by an enter.
;The first key can help to switch this on or off, the popup has been commented cause if close the sublimetext popup, next there will no need of activate or deactivate
;the special chars line, instead manually change the status on or off, it could be simpler to detect if that popup exists or not by using an exact pixel detection.
;the shift, control, alt and altgr can be used as normally.
;Simly configure the script as azerty or qwerty cause some chars are identicals.
;CONFIGURATION:
;azertyOrQwerty:=true
;USAGE:
;Double press the first special char key to change status on or off, the default is to off.
;Double press the first key and keep it down after 150 ms is enough to send it normally while status in on.
;Single press a special char send the equivalent number of keys according to its position on that keyboard line.
;Keep after 150ms will send up, not down, because sometimes the popupcompletion show the current selected entry
;to the middle of the menu or as the last entry, not the first, nothing can predict this with certainty.
;NOTE: the next entry is not supported, it require the pixel detection to be sure the first key can be accessible.
global azertyOrQwerty
global startchars2
global startchars2bis
indexme(alist,aval)
{
;Msgbox,% alist.Length() "--" aval
Loop,% alist.Length()
{
if (alist[A_Index]=aval)
{
;,"THE SAME !"
Return A_Index
}
}
Return 0
}
#If WinActive("ahk_exe sublime_text.exe")
global lockme:=1
;>!@::
;>!#::
;>!$::
;>!%::
;>!^::
;>!*::
;>!)::
;>!&::
;>!é::
;>!"::
;>!'::
;>!(::
;>!§::
;>!è::
;>!!::
;>!ç::
;>!à::
$@::
$#::
$$::
$%::
$^::
$*::
$)::
$&::
$é::
$"::
$'::
$(::
$§::
$è::
$!::
$ç::
$à::
;Msgbox,% A_ThisHotkey
uniqchar:=LTrim(A_ThisHotkey,"~")
uniqchar:=LTrim(uniqchar,"$")
;Msgbox,% uniqchar
if (uniqchar="&")
{
;Msgbox,% uniqchar
if ((A_TimeSincePriorHotkey < 300) and (A_TimeSincePriorHotkey > 50))
{
;Send,{%uniqchar%}
;Msgbox,% "dddd"
sleep,150
aastate0:=GetKeyState("&","P")
if (aastate0=1)
{
Send,{&}
Return
}
if (lockme=1)
{
lockme:=0
}
else
{
lockme:=1
}
;Msgbox,4096,SPECHARLOCK,Special chars lock is %lockme%,0.5
;NO STATUS CAUSE IT CLOSE COMPLETION POPUP
Return
}
Return
}
sleep,150
aastate0:=GetKeyState(uniqchar,"P")
if (aastate0=1)
{
reverseorder:=1
;lockme:=1
}
else
{
reverseorder:=0
}
azertyOrQwerty:=true
startchars2:=["!","@","#","$","%","^","&","*","(",")"]
startchars2Exceptions:=["$"]
startchars2bis:=["&","é","""","'","(","§","è","!","ç","à"]
startchars2bisExceptions:=["&","é","""","'","(","§","è","!","ç","à"]
aastate1:=GetKeyState("RAlt","P")
aastate2:=GetKeyState("Control","P")
aastate3:=GetKeyState("Alt","P")
aastate4:=GetKeyState("Shift","P")
if ((lockme=1) OR (aastate1=1) OR ((aastate2=1) AND (aastate3=1)) OR (aastate4=1))
{
;Msgbox,"OPA"
Send, {%uniqchar%}
}
else
{
;Msgbox,% azertyOrQwerty
if (azertyOrQwerty=true)
{
;Msgbox,% "OOOO" uniqchar
superind:=indexme(startchars2bis,uniqchar)
;Msgbox,% superind
superind2:=indexme(startchars2,uniqchar)
}
else
{
superind:=indexme(startchars2,uniqchar)
superind2:=indexme(startchars2bis,uniqchar)
}
;Msgbox,% superind
;
if (superind=0)
{
Send, {%uniqchar%}
Return
}
Loop,% superind
{
if (reverseorder=1)
{
Send, {Up}
}
else
{
Send, {Down}
}
Sleep,35
}
Sleep,100
Send,{Tab}
}
return
#If
;This lines below are additionnals, it can help when using a window and its full height can't extend at max, so let switch the taskbar and on top flags.
;WIN KEY + F4 OR F5
ABM_SETSTATE := 10
ABS_NORMAL := 0x0
ABS_AUTOHIDE := 0x1
ABS_ALWAYSONTOP := 0x2
VarSetCapacity( APPBARDATA , 36, 0 )
Off := NumPut( 36, APPBARDATA )
Off := NumPut( WinExist("ahk_class Shell_TrayWnd"), Off+0 )
#F4::
NumPut( ABS_ALWAYSONTOP, Off+24 )
DllCall("Shell32.dll\SHAppBarMessage", UInt,ABM_SETSTATE, UInt,&APPBARDATA )
Return
#F5::
NumPut( ABS_AUTOHIDE|ABS_ALWAYSONTOP, Off+24 )
DllCall("Shell32.dll\SHAppBarMessage", UInt,ABM_SETSTATE, UInt,&APPBARDATA )
Return