Last active
November 21, 2022 16:21
-
-
Save GeekyDeaks/59cc86b4666a1b3d7c42ac0a36b4d5f0 to your computer and use it in GitHub Desktop.
AHK scripts
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
; Joystick Test Script | |
; https://www.autohotkey.com | |
; This script helps determine the button numbers and other attributes | |
; of your joystick. It might also reveal if your joystick is in need | |
; of calibration; that is, whether the range of motion of each of its | |
; axes is from 0 to 100 percent as it should be. If calibration is | |
; needed, use the operating system's control panel or the software | |
; that came with your joystick. | |
; July 6, 2005: Added auto-detection of joystick number. | |
; May 8, 2005 : Fixed: JoyAxes is no longer queried as a means of | |
; detecting whether the joystick is connected. Some joysticks are | |
; gamepads and don't have even a single axis. | |
#SingleInstance | |
SetFormat, float, 03 ; Omit decimal point from axis position percentages. | |
Loop | |
{ | |
TTText = "" | |
Loop 16 ; Query each joystick number to find out which ones exist. | |
{ | |
GetKeyState, joy_buttons, %A_Index%JoyButtons | |
GetKeyState, joy_name, %A_Index%JoyName | |
GetKeyState, joy_info, %A_Index%JoyInfo | |
buttons_down = | |
Loop, %joy_buttons% | |
{ | |
GetKeyState, joy%A_Index%, %JoystickNumber%joy%A_Index% | |
if joy%A_Index% = D | |
buttons_down = %buttons_down%%A_Space%%A_Index% | |
} | |
GetKeyState, JoyX, %JoystickNumber%JoyX | |
axis_info = X%JoyX% | |
GetKeyState, JoyY, %JoystickNumber%JoyY | |
axis_info = %axis_info%%A_Space%%A_Space%Y%JoyY% | |
IfInString, joy_info, Z | |
{ | |
GetKeyState, JoyZ, %JoystickNumber%JoyZ | |
axis_info = %axis_info%%A_Space%%A_Space%Z%JoyZ% | |
} | |
IfInString, joy_info, R | |
{ | |
GetKeyState, JoyR, %JoystickNumber%JoyR | |
axis_info = %axis_info%%A_Space%%A_Space%R%JoyR% | |
} | |
IfInString, joy_info, U | |
{ | |
GetKeyState, JoyU, %JoystickNumber%JoyU | |
axis_info = %axis_info%%A_Space%%A_Space%U%JoyU% | |
} | |
IfInString, joy_info, V | |
{ | |
GetKeyState, JoyV, %JoystickNumber%JoyV | |
axis_info = %axis_info%%A_Space%%A_Space%V%JoyV% | |
} | |
IfInString, joy_info, P | |
{ | |
GetKeyState, joyp, %JoystickNumber%JoyPOV | |
axis_info = %axis_info%%A_Space%%A_Space%POV%joyp% | |
} | |
TTText = %TTText% %joy_name% (#%JoystickNumber%): %axis_info% Buttons Down: %buttons_down%`n | |
Sleep, 100 | |
} | |
ToolTip, %TTText% (right-click the tray icon to exit) | |
} | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment