-
Notifications
You must be signed in to change notification settings - Fork 1
/
XShortcuts.ahk
58 lines (49 loc) · 1.58 KB
/
XShortcuts.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
#SingleInstance Ignore
;Collection of AutoHotKey-Scripts for Xinput (Xbox 360/Xbox One-controller)
;Get AutoHotkey v2 or higher from Chocolatey via https://www.autohotkey.com/download/
;Get xinput.ahk from https://www.autohotkey.com/board/topic/35848-xinput-xbox-360-controller-api/
#include xinput.ahk
XInput_Init()
Loop {
Loop, 4 {
if State := XInput_GetState(A_Index-1) {
BACK := State.wButtons & XINPUT_GAMEPAD_BACK
START := State.wButtons & XINPUT_GAMEPAD_START
LSTICK := State.wButtons & XINPUT_GAMEPAD_LEFT_THUMB
RSTICK := State.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB
LSHOULDER := State.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER
RSHOULDER := State.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER
}
}
;Both shoulder-buttons + left stick click -> Launch Playnite Fullscreen
if (LSTICK && LSHOULDER && RSHOULDER)
{
run "%LOCALAPPDATA%\Playnite\Playnite.FullscreenApp.exe"
sleep 1000 ;
}
;Back + Start -> Quit active window
if (START && BACK)
{
WinClose A
sleep 900
}
;Back + right stick click -> send Esc
if (BACK && RSTICK)
{
sleep 100
Send, {Esc}
}
;Back + left stick click -> mouse click in middle of the active window
if (BACK && LSTICK)
{
;Get window size and click on half position of window
CoordMode, Click, Window
WinGetPos, winX, winY, winWidth, winHeight, A
X := winWidth * 0.5
Y := winHeight * 0.5
Click %X% %Y%
;Hacky way to move mouse to lowerright corner
MouseMove, 4000, 4000
}
Sleep, 100
}