Page 1 of 1

X360 Gamepad, simple alt+f4 script

Posted: 11 Feb 2020, 15:52
by torrentula83
Hi,
I usually exit games easilly with xpadder, however in a few games it won't work.
I'm confused as to why but it just doesn't work, might be related to xinput stuff... but I don't get any of it.
Just installed autohotkey and couldn't figure out what I was doing wrong with this simple script :

(xbox360 gamepad, windows10 pro 64)

Code: Select all

outer:
Loop
{
    if GetKeyState("Joy10")  ; Right Stick button has been pressed
	{
		if (GetKeyState("JoyZ") = 000)  ; Right Trigger has been pressed
		{
			Send !{f4} ; Simulates alt+f4 keypress
			break outer  ;
		}
	}
	sleep, 100
}
break_outer:
also tried :

Code: Select all

outer:
Loop
{
    if GetKeyState("XINPUT_GAMEPAD_10")  ; Right Stick button has been pressed
	{
		if (GetKeyState("XINPUT_GAMEPAD_Z") = 000)  ; Right Trigger has been pressed
		{
			Send !{f4} ; Simulates alt+f4 keypress
			break outer  ;
		}
	}
	sleep, 100
}
break_outer:
Is this post from evilC still relevant ?
Is my script ok ? Is there a loop limit ?
Do I need to use xinput libraries ?

Edit : Nevermind, got it sorted by pasting dinput & dinput8 dlls next to game's exe... it might not work for every game tho. So just in case someone with a Pinball Fx3 cabinet is passing by, there you have it ^^

Also wondering if anyone has ever been able to remap middle guide button ?