Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joyrider3774/23af83e4ae92b4aab550c999c263eef9 to your computer and use it in GitHub Desktop.
Save joyrider3774/23af83e4ae92b4aab550c999c263eef9 to your computer and use it in GitHub Desktop.
#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
}
@xCeLeSx
Copy link

xCeLeSx commented Jan 6, 2023

Hi @joyrider3774 , could you please check possibility to edit this script to work with Win10 and Wireless Xbox Series Controler?
I compiled this version but without success :(

@joyrider3774
Copy link
Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment