-
Notifications
You must be signed in to change notification settings - Fork 1
/
Hitman_Absolution.ahk
705 lines (662 loc) · 9.3 KB
/
Hitman_Absolution.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
#SingleInstance force
#Persistent ; Keep this script running until the user explicitly exits it.
;#Warn ; Enable warnings to assist with detecting common errors.
Layer := 1
Toggle_Right := 0
SetCapsLockState, AlwaysOff
SetScrollLockState, AlwaysOff
Process, Priority, , A
SetTitleMatchMode, 2
;#HotkeyInterval 2000 ; This is the default value (milliseconds).
;#MaxHotkeysPerInterval 500
;#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
}
{ ; AutoHotKey Script option.
#F1::Suspend, Toggle
#F4::ExitApp
;^SPACE:: Winset, Alwaysontop, , A ; Toggle Active Windows Always on Top.
^!f:: ; FullScreen Window. Control+Alt+F
{
WinGetTitle, currentWindow, A
IfWinExist %currentWindow%
{
WinSet, Style, ^0xC00000 ; toggle title bar
WinMove, , , 0, 0, 1920, 1080
}
return
}
} ; AutoHotKey Script option.
{ ; Joystick ID (Use JoyID Program)
;4Joy = T16000L (See JoyID)
;Joy = Vjoy
}
{ ; Testing
/* ; If prior key ""
$m::
If (A_PriorKey = "space")
{
SendInput {p Down}
KeyWait m
Send {p Up}
}
Else
{
Send {m Down}
KeyWait m
Send {m Up}
}
return
*/
/* ; 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
*/
/* ; Multi-Tap
{
$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
}
*/
/* ; Watch axis
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
*/
/* ; Joystick layer, shift
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
*/
/* ; Multi-Tap
$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. Press and hold to get into Layer 2, double press and hold to get into Layer 3. Release to come back to Layer 1.
CapsLock:: ;Key disabled by "SetCapsLockState, AlwaysOff".
Layer := 2
if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 333)
Layer := 3
KeyWait, CapsLock
Layer := 1
Return
}
WheelUp::
{
If (Layer=1) and GetKeyState("MButton")
{
SetkeyDelay, 0, 32
Send {Home}
Return
}
Else if (Layer=2)
{
SetkeyDelay, 0, 32
Send {PgUp}
Return
}
/*
Else if (Layer=3)
{
SetkeyDelay, 0, 32
Send {Right}
Return
}
*/
Else
{
Send {WheelUp}
Return
}
Return
}
WheelDown::
{
If (Layer=1) and GetKeyState("MButton")
{
SetkeyDelay, 0, 32
Send {End}
Return
}
Else if (Layer=2)
{
SetkeyDelay, 0, 32
Send {PgDn}
Return
}
/*
Else if (Layer=3)
{
SetkeyDelay, 0, 32
Send {Left}
Return
}
*/
Else
{
Send {WheelDown}
Return
}
Return
}
$SC002::
{
If (Layer=1)
{
Send {SC002 Down}
KeyWait, SC002
Send {SC002 Up}
Return
}
Else If (Layer=2)
{
Send {F1 Down}
KeyWait, SC002
Send {F1 Up}
Return
}
Else if (Layer=3)
{
Send {Numpad2 Down}
KeyWait, SC002
Send {Numpad2 Up}
Return
}
}
$SC029::
{
If (Layer=1)
{
Send {esc Down}
KeyWait, SC029
Send {esc Up}
}
Else
{
Send {SC029 Down}
KeyWait, SC029
Send {SC029 Up}
}
Return
}
$Tab::
{
If (Layer=1)
{
Send {Tab Down}
KeyWait, Tab
Send {Tab Up}
}
Else If (Layer=2)
{
Send {esc Down}
KeyWait, Tab
Send {esc Up}
}
Else
{
Send {Tab Down}
KeyWait, Tab
Send {Tab Up}
}
Return
}
$w::
{
If (Layer=1)
{
Send {w Down}
KeyWait, w
Send {w Up}
Return
}
Else If (Layer=2)
{
Send {b Down}
KeyWait, w
Send {b Up}
Return
}
Else if (Layer=3)
{
Send {Numpad1 Down}
KeyWait, w
Send {Numpad1 Up}
Return
}
}
$x::
{
If (Layer=1)
{
Send {x Down}
KeyWait, x
Send {x Up}
Return
}
Else If (Layer=2)
{
Send {n Down}
KeyWait, x
Send {n Up}
Return
}
Else if (Layer=3)
{
Send {Numpad2 Down}
KeyWait, x
Send {Numpad2 Up}
Return
}
}
$c::
{
If (Layer=1)
{
Send {c Down}
KeyWait, c
Send {c Up}
Return
}
Else If (Layer=2)
{
Send {, Down}
KeyWait, c
Send {, Up}
Return
}
Else if (Layer=3)
{
Send {Numpad3 Down}
KeyWait, c
Send {Numpad3 Up}
Return
}
}
$r::
{
If (Layer=1)
{
Send {r Down}
KeyWait, r
Send {r Up}
Return
}
Else If (Layer=2)
{
KeyWait r, t0.100
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {y down}
Sleep 32
SendInput {y up}
KeyWait, r
}
else
{
SendInput {t down}
sleep 32
SendInput {t up}
KeyWait, r
}
return
}
Else if (Layer=3)
{
KeyWait r, t0.100
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {i down}
sleep 32
SendInput {i up}
KeyWait, r
}
else
{
SendInput {u down}
sleep 32
SendInput {u up}
KeyWait, r
}
return
}
Else
{
Send {r Down}
KeyWait, r
Send {r Up}
Return
}
}
$f::
{
If (Layer=1)
{
Send {f Down}
KeyWait, f
Send {f Up}
Return
}
Else If (Layer=2)
{
KeyWait f, t0.100
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {h down}
Sleep 32
SendInput {h up}
KeyWait, f
}
else
{
SendInput {g down}
sleep 32
SendInput {g up}
KeyWait, f
}
Return
}
Else if (Layer=3)
{
KeyWait f, t0.100
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {k down}
sleep 32
SendInput {k up}
KeyWait, f
}
else
{
SendInput {j down}
sleep 32
SendInput {j up}
KeyWait, f
}
Return
}
Else
{
Send {f Down}
KeyWait, f
Send {f Up}
Return
}
}
$v::
{
If (Layer=1)
{
Send {v Down}
KeyWait, v
Send {v Up}
Return
}
Else If (Layer=2)
{
Send {; Down}
KeyWait, v
Send {; Up}
Return
}
Else if (Layer=3)
{
Send {! Down}
KeyWait, v
Send {! Up}
Return
}
}
$a::
{
If (Layer=1)
{
Send {a Down}
KeyWait, a
Send {a Up}
Return
}
Else If (Layer=2)
{
Send {SC006 Down}
KeyWait, a
Send {SC006 Up}
Return
}
Else If (Layer=3)
{
Send {LShift Down}{LAlt Down}{Up}{LShift Up}{LAlt Up}
Return
}
Return
}
$e::
{
If (Layer=1)
{
Send {e Down}
KeyWait, e
Send {e Up}
Return
}
Else If (Layer=2)
{
Send {SC007 Down}
KeyWait, e
Send {SC007 Up}
Return
}
Else If (Layer=3)
{
Send {LShift Down}{LAlt Down}{Down}{LShift Up}{LAlt Up}
Return
}
Return
}
Right::
{
If Toggle_Right = 0
{
SendInput {Right Down}
Toggle_Right := !Toggle_Right
Return
}
Else If Toggle_Right = 1
{
SendInput {Right Up}
Toggle_Right := !Toggle_Right
Return
}
Return
}
~XButton2::
{
If Toggle_Right = 1
{
SendInput {Right Up}
Toggle_Right := !Toggle_Right
Return
}
Return
}