Created
August 24, 2022 20:01
-
-
Save joyrider3774/23af83e4ae92b4aab550c999c263eef9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SingleInstance Ignore | |
;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 | |
RSTICK := State.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB | |
LSTICK := State.wButtons & XINPUT_GAMEPAD_LEFT_THUMB | |
} | |
} | |
;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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@xCeLeSx what kind of controller are you using ? I have an official xbox one x and and xbox series x controller that i use with this script personally.
If using an xbox 360 controller it won't work i think but i have another script for that