-
Notifications
You must be signed in to change notification settings - Fork 1
/
StarCraft_2.ahk
979 lines (840 loc) · 14.7 KB
/
StarCraft_2.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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
#SingleInstance force
#Persistent ; Keep this script running until the user explicitly exits it.
#Warn ; Enable warnings to assist with detecting common errors.
Layer := 1
SetCapsLockState, AlwaysOff
SetScrollLockState, AlwaysOff
Process, Priority, , A
;#InstallKeybdHook
;#InstallMouseHook
CoordMode, mouse, Screen
{ ;Monitoring Windows
BlockInput, On
KeyHistory
WinGetActiveTitle, Title
WinWait, %Title%
SetKeyDelay 0, 32
Send {Lwin down}{Right}{Right}{Right}{Right}{Lwin up}{LControl down}{k}{LControl Up}
#IfWinExist Event Tester
{
WinClose Event Tester
Run, C:\Program Files (x86)\Thrustmaster\TARGET\Tools\EventTester.exe
WinWait, Event Tester
SetKeyDelay 0, 32
Send {Lwin down}{Right}{Right}{Lwin up}{esc}{esc}{esc}{esc}
Sleep 32
MouseClick, left, 1952, 66
MouseClick, left, 2016, 91
BlockInput, Off
return
}
#IfWinExist
#If WinActive("Event Tester") || WinActive("AHK Studio - C:\Users\hon0_Corsair\Documents\GitHub\AutoHotKey_Script\AutoHotKey_Script.ahk")
{
$F5::
WinActivate %Title%
SetKeyDelay 2000, 32
Send {F5}
return
}
#IfWinActive
{ ; Tray Icon If Pause and/or Suspend
OnMessage(0x111,"WM_COMMAND")
return
WM_Command(wP) {
static Suspend:=65305, Pause:=65306
If (wP = Suspend)
If !A_IsSuspended
Menu, Tray, Icon, Shell32.dll, 132, 1
Else If A_IsPaused
Menu, Tray, Icon, Shell32.dll, 110, 1
Else
Menu, Tray, Icon, %A_AhkPath%
Else If (wP = Pause)
If !A_IsPaused
Menu, Tray, Icon, Shell32.dll, 110, 1
Else If A_IsSuspended
Menu, Tray, Icon, Shell32.dll, 132, 1
Else
Menu, Tray, Icon, %A_AhkPath%
}
}
}
{ ;Before running a Game. Run and/or close Program.
#F1::Suspend, Toggle
#F4::ExitApp
^#!SPACE:: Winset, Alwaysontop, , A ; Toggle Active Windows Always on Top.
#t::
{
If !WinExist("MSI Afterburner")
{
Run, C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe
WinWait MSI Afterburner
MsgBox Check Mouse and keyboard profile!
}
Else If !WinExist("Set Timer Resolution")
{
Run, D:\- Téléchargements sur D\TimerResolution.exe
WinWait Set Timer Resolution
WinMinimize Set Timer Resolution
WinWait MSI Afterburner
}
Else if WinExist("MSI Afterburner") || WinExist("Set Timer Resolution")
{
WinActivate, MSI Afterburner
WinActivate, Set Timer Resolution
}
return
}
} ;Before running a Game. Run and/or close Program.
{ ;Joystick ID (Use JoyID Program)
;6Joy = T16000L (See JoyID)
;5Joy = Vjoy
}
{ ;Testing
/* ; If prior key ""
{ ; If prior key ""
m::
Send o
if (A_PriorKey = "space")
SendInput {p}
return
}
*/
; Pixel color as as condition
/*{ ; Pixel color as as condition
!#z::
MouseGetPos, xpos, ypos
;PixelGetColor, color, xpos, xpos
PixelGetColor, color, 1889, 95
;MsgBox The color at X%xpos% Y%ypos% is %color%.
MsgBox The color is %color%.
return
{ ; Numpad1
Numpad1::
PixelGetColor, color, 1889, 95
if color = 0x213A70
{
MouseGetPos, xpos, ypos
BlockInput, On
MouseClick, left, 1732, 171
MouseMove, xpos, ypos
BlockInput, Off
return
}
Else
{
MouseGetPos, xpos, ypos
BlockInput, On
SetKeyDelay 32, 32
Send {NumpadEnter}
MouseClick, left, 1732, 171
MouseMove, xpos, ypos
BlockInput, Off
}
Return
}
}*/
/* ; On press != on double press != on long press.
$a::
KeyWait, a, T0.1
if (ErrorLevel)
{
Send {b down}
keywait a
Send {b up}
}
else {
KeyWait, a, D T0.1
if (ErrorLevel)
{
Send {a down}
keywait a
Send {a up}
}
else
{
Send {c down}
keywait a
Send {c up}
}
}
KeyWait, a
return
*/
/*
{
$f1::
{
count++
settimer, actions, 333
}
return
actions:
{
if (count = 1)
{
send {F1}
}
else if (count = 2)
{
send {F2}
}
else if (count = 3)
{
send {F3}
}
count := 0
}
return
SetTimer, WatchAxis, 5
return
WatchAxis:
GetKeyState, 6JoyX, 6JoyX ; Get position of X axis.
GetKeyState, 6JoyY, 6JoyY ; Get position of Y axis.
KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
if 6JoyX > 70
KeyToHoldDown = Right
else if 6JoyX < 30
KeyToHoldDown = Left
else if 6JoyY > 70
KeyToHoldDown = Down
else if 6JoyY < 30
KeyToHoldDown = Up
else
KeyToHoldDown =
if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down (or no key is needed).
return ; Do nothing.
; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1 ; Avoid delays between keystrokes.
if KeyToHoldDownPrev ; There is a previous key to release.
Send, {%KeyToHoldDownPrev% up} ; Release it.
if KeyToHoldDown ; There is a key to press down.
Send, {%KeyToHoldDown% down} ; Press it down.
return
6Joy1::
If GetKeyState("6Joy2", "P")=1
{
send {d Down}
keywait 6Joy1
send, {d Up}
}
else
if GetKeyState("6joy3", "p")=1
{
send {v Down}
keywait 6Joy1
send, {v Up}
}
Else
{
send {c Down}
keywait 6Joy1
send, {c Up}
}
Return
$f8::
{
count++
settimer, actionsF8, 200
}
return
actionsF8:
{
if (count = 1)
{
send {F8}
}
else if (count = 2)
{
send {F9}
}
else if (count = 3)
{
send {F10}
}
count := 0
}
return
}
*/
}
/* ;Layer checker
z::
ToolTip %Layer%
SetTimer, RemoveToolTip, 2000
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
*/
{ ; Layer modifier
CapsLock:: ;Key disabled by "SetCapsLockState, AlwaysOff".
Layer := 2
if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 200)
Layer := 3
KeyWait, CapsLock
Layer := 1
Return
}
{ #if Layer = 1
{ ;Global remapping
;#IfWinActive EscapeFromTarkov
XButton2::
SetKeyDelay 32, 32
send ^t
Return
XButton1::t
~Right & LButton::F1
Return
~Right & RButton::F2
Return
~Right & XButton1::F3
Return
~Right & XButton2::F4
Return
~Right & WheelUp::
send, {F5}
Sleep, 100
Return
~Right & WheelDown::
send, {F6}
Sleep, 100
Return
~Right & MButton::F7
Return
~Right & F8::F9
Return
~Right & F9::F10
Return
;#IfWinActive
}
{ ; Mouse Wheel Layer 1
~WheelUp::
SetkeyDelay, 0, 32
If GetKeyState("MButton")
send {Home}
;Else
; If (GetKeyState("6Joy1")==1)
; send g
Return
~WheelDown::
SetkeyDelay, 0, 32
If GetKeyState("MButton")
send {End}
;Else
; If GetKeyState("Space")
; send {End}
Return
}
{ ; All Layer 1 Digit remapping Layer 1 Short/Long, Layer 2 Short/Long, Layer 3 Short/Long
$SC002:: ;[1, F1], [7, F7], [F13, F19]
KeyWait SC002, t0.200&
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
Send {F1 down}
KeyWait SC002
SendInput {F1 up}
}
else
{
SendInput {SC002 down}
sleep 32
KeyWait SC002
SendInput {SC002 up}
}
return
$SC003:: ;[2, F2], [8, F8], [F14, F20]
KeyWait SC003, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F2 down}
KeyWait SC003
SendInput {F2 up}
}
else
{
SendInput {SC003 down}
sleep 32
KeyWait SC003
SendInput {SC003 up}
}
return
$SC004:: ;[3, F3], [9, F9], [F15, F21]
KeyWait SC004, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F3 down}
KeyWait SC004
SendInput {F3 up}
}
else
{
SendInput {SC004 down}
sleep 32
KeyWait SC004
SendInput {SC004 up}
}
return
$SC005:: ;[4, F4], [10, F10], [F16, F22]
KeyWait SC005, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F4 down}
KeyWait SC005
SendInput {F4 up}
}
else
{
SendInput {SC005 down}
sleep 32
KeyWait SC005
SendInput {SC005 up}
}
return
$SC006:: ;[5, F5], [11, F11], [F17, F23]
KeyWait SC006, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F5 down}
KeyWait SC006
SendInput {F5 up}
}
else
{
SendInput {SC006 down}
sleep 32
KeyWait SC006
SendInput {SC006 up}
}
return
$SC007:: ;[6, F6], [12, F12], [F18, F24]
KeyWait SC007, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F6 down}
KeyWait SC007
SendInput {F6 up}
}
else
{
SendInput {SC007 down}
sleep 32
KeyWait SC007
SendInput {SC007 up}
}
return
}
#If ; End of "If Layer = 1".
}
{ #if Layer = 2
{ ; Global remapping
;#IfWinActive EscapeFromTarkov
LButton::F1
RButton::F2
XButton1::F3
XButton2::F4
tab::!l
w::b
x::n
c::,
v::Del
F8::F9
F9::F10
;#IfWinActive
}
{ ; Mouse Wheel Layer 2
~WheelUp::
SetkeyDelay, 0, 32
send {PgUp}
Return
~WheelDown::
SetkeyDelay, 0, 32
send {PgDn}
Return
}
{ ;All Layer 2 Digit remapping Layer 1 Short/Long, Layer 2 Short/Long, Layer 3 Short/Long
$SC002:: ;[1, F1], [7, F7], [F13, F19]
KeyWait SC002, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F7 down}
KeyWait SC002
SendInput {F7 up}
}
else
{
SendInput {SC008 down}
sleep 32
KeyWait SC002
SendInput {SC008 up}
}
return
$SC003:: ;[2, F2], [8, F8], [F14, F20]
KeyWait SC003, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F8 down}
KeyWait SC003
SendInput {F8 up}
}
else
{
SendInput {SC009 down}
sleep 32
KeyWait SC003
SendInput {SC009 up}
}
return
$SC004:: ;[3, F3], [9, F9], [F15, F21]
KeyWait SC004, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F9 down}
KeyWait SC004
SendInput {F9 up}
}
else
{
SendInput {SC00A down}
sleep 32
KeyWait SC004
SendInput {SC00A up}
}
return
$SC005:: ;[4, F4], [10, F10], [F16, F22]
KeyWait SC005, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F10 down}
KeyWait SC005
SendInput {F10 up}
}
else
{
SendInput {SC00B down}
sleep 32
KeyWait SC005
SendInput {SC00B up}
}
return
$SC006:: ;[5, F5], [11, F11], [F17, F23]
KeyWait SC006, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F11 down}
KeyWait SC006
SendInput {F11 up}
}
else
{
SendInput {SC00C down}
sleep 32
KeyWait SC006
SendInput {SC00C up}
}
return
$SC007:: ;[6, F6], [12, F12], [F18, F24]
KeyWait SC007, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F12 down}
KeyWait SC007
SendInput {F12 up}
}
else
{
SendInput {SC00D down}
sleep 32
KeyWait SC007
SendInput {SC00D up}
}
return
}
{ ;Layer 2 "f" remapping
$f::
KeyWait f, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {h down}
KeyWait f
SendInput {h up}
}
else
{
SendInput {g down}
sleep 32
SendInput {g up}
}
return
}
{ ;Layer 2 "r" remapping
$r::
KeyWait r, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {y down}
KeyWait r
SendInput {y up}
}
else
{
SendInput {t down}
sleep 32
SendInput {t up}
}
return
}
#If ; End of "If Layer = 2".
}
{ #if Layer = 3
{ ; Global remapping
;#IfWinActive EscapeFromTarkov
LButton::F1
RButton::F2
XButton1::F3
XButton2::F4
tab::AppsKey
w::Numpad0
x::Numpad1
c::Numpad2
v::Numpad3
;r::y
;f::h
F8::F9
F9::F10
;#IfWinActive
}
{ ; Mouse Wheel Layer 3
SetkeyDelay, 0, 32
If GetKeyState("MButton")
send {PGUP}
else
send {Insert}
;Else
; If (GetKeyState("6Joy1")==1)
; send g
Return
~WheelDown::
SetkeyDelay, 0, 32
If GetKeyState("MButton")
send {PGDN}
Else
send {Del}
;Else
; If GetKeyState("Space")
; send {End}
Return
}
{ ;All Layer 3 Digit remapping Layer 1 Short/Long, Layer 2 Short/Long, Layer 3 Short/Long
$SC002:: ;[1, F1], [7, F7], [F13, F19]
KeyWait SC002, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F19 down}
KeyWait SC002
SendInput {F19 up}
}
else
{
SendInput {F13 down}
sleep 32
KeyWait SC002
SendInput {F13 up}
}
return
$SC003:: ;[2, F2], [8, F8], [F14, F20]
KeyWait SC003, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F20 down}
KeyWait SC003
SendInput {F20 up}
}
else
{
SendInput {F14 down}
sleep 32
KeyWait SC003
SendInput {F14 up}
}
return
$SC004:: ;[3, F3], [9, F9], [F15, F21]
KeyWait SC004, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F21 down}
KeyWait SC004
SendInput {F21 up}
}
else
{
SendInput {F15 down}
sleep 32
KeyWait SC004
SendInput {F15 up}
}
return
$SC005:: ;[4, F4], [10, F10], [F16, F22]
KeyWait SC005, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F22 down}
KeyWait SC005
SendInput {F22 up}
}
else
{
SendInput {F16 down}
sleep 32
KeyWait SC005
SendInput {F16 up}
}
return
$SC006:: ;[5, F5], [11, F11], [F17, F23]
KeyWait SC006, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F23 down}
KeyWait SC006
SendInput {F23 up}
}
else
{
SendInput {F17 down}
sleep 32
KeyWait SC006
SendInput {F17 up}
}
return
$SC007:: ;[6, F6], [12, F12], [F18, F24]
KeyWait SC007, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F24 down}
KeyWait SC007
SendInput {F24 up}
}
else
{
SendInput {F18 down}
sleep 32
KeyWait SC007
SendInput {F18 up}
}
return
}
{ ;Layer 3 "f" remapping
$f::
KeyWait f, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {k down}
KeyWait f
SendInput {k up}
}
else
{
SendInput {j down}
sleep 32
SendInput {j up}
}
return
}
{ ;Layer 3 "r" remapping
$r::
KeyWait r, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {i down}
KeyWait r
SendInput {i up}
}
else
{
SendInput {u down}
sleep 32
SendInput {u up}
}
return
}
#If ; End of "If Layer = 3".
}
{ ;HotStrings
:*:ahk::AutoHotKey
::viei@::[email protected]
}
#g::
MouseGetPos, xpos, ypos
MsgBox, The cursor is at X%xpos% Y%ypos%.
return
#s::
MouseClick, left, 36, 40
MouseClick, left, 104, 62
return
#x::
MouseMove, 50, -50 , 10, R ;moves the mouse in a box
MouseMove, -100, 0 , 10, R ;around it's starting position
MouseMove, 0, 100 , 10, R
MouseMove, 100, 0 , 10, R
MouseMove, 0, -100 , 10, R
MouseMove, -50, 50 , 10, R
return
^!s::Suspend
#IfWinActive Java Tutorial | SoloLearn: Learn to code for FREE! - Google Chrome
$Mbutton::
BlockInput, On
;SetKeyDelay 32, 32
Send {RButton}{down}{down}{Enter}{LWin down}{Right}{LWin Up}
#IfWinExist Code Playground | SoloLearn: Learn to code for FREE! - Google Chrome
WinClose Code Playground | SoloLearn: Learn to code for FREE! - Google Chrome
WinWait Code Playground | SoloLearn: Learn to code for FREE! - Google Chrome
sleep 32
send {space}
WinWait Code Playground | SoloLearn: Learn to code for FREE! - Google Chrome
Send {MButton Up}
BlockInput, Off
return
#IfWinExist
#IfWinActive
/*sleep 32
MouseClick, left, 1400, 600
sleep 32
Send ^a
sleep 32
Send ^c
sleep 32
MouseClick, left, 2700, 600
sleep 32
Send ^a
sleep 32
Send ^v
Send {MButton Up}{F9}
BlockInput, Off
return
#IfWinExist
#IfWinActive
*/