System = Windows 10 64 bits - version 1803
AHK installation method = unzip in a directory
Using = AutoHotKeyU64.exe
Hotas Driver = Logitech 18.104.22.168 (latest), but not sure it really has any impact
Specifics = remember that the X56 is a Hotas, so it has two USB devices = one USB plug for the Throttle, and one USB plug for the Stick
Symptom = depending on when I start AHK (e.g. load a script) with regards to joystick plug sequence, I get at best one joystick handled (the first one plugged) or none working.
It all looks like AHK is really discovering the joysticks at start of script only, and not later, and for some reason, if it detects two joysticks, it has a problem.
For this experiment, I am using a modified version of of JoystickTest.ahk:
; Modified Joystick Test Script
; 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.
; May 2018 : loop to display all plugged joysticks, and not only one
; END OF CONFIG SECTION. Do not make changes below this point unless
; you wish to alter the basic functionality of the script.
; Loop, auto-detecting joysticks
SetFormat, float, 03 ; Omit decimal point from axis position percentages.
TooltipMsg = Joysticks:
JoystickNumber = 0
Loop 16 ; Query each joystick number to find out which ones exist.
GetKeyState, JoyName, %A_Index%JoyName
if JoyName <>
JoystickNumber = %A_Index%
GetKeyState, joy_buttons, %JoystickNumber%JoyButtons
GetKeyState, joy_info, %JoystickNumber%JoyInfo
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%
TooltipMsg = %TooltipMsg%`n%JoyName% (#%JoystickNumber%) %joy_info%:`n%axis_info%`nButtons Down: %buttons_down%
if JoystickNumber <= 0
TooltipMsg = The system does not appear to have any joystick
ToolTip, %TooltipMsg%`n`n(right-click the tray icon to exit)
- If I start the script above, no device plugged, I get the tooltip "The system does not appear to have any joystick" => normal
Then if I plug the stick, I get both "Microsoft PC-joystick driver (#1) RUVPD" and "Microsoft PC-joystick driver (#2)", and for #1 all axis values are fine & buttons are detected ok => so far so good
Then if I plug the throttle, nothing more appears, the values for #2 are empty and not moving, while #1 is ok
Then if I unplug #1, #1 values are not active any more, but nothing better happens on #2.
Then if I plug again #1, its values reappear and buttons are detected again for a few cycles, but then AHK crashes !
In the Winfows event log, I can see:
Faulting application name: AutoHotkeyU64.exe, version: 22.214.171.124, time stamp: 0x5b122a60
Faulting module name: CoreMessaging.dll, version: 10.0.17134.191, time stamp: 0x407d3bd9
Exception code: 0xc0000005
Fault offset: 0x0000000000054880
Faulting process id: 0x1290
Faulting application start time: 0x01d4330b72e871a1
Faulting application path: M:\Produits\Elite Dangerous\AutoHotKey\AutoHotkeyU64.exe
Faulting module path: C:\WINDOWS\SYSTEM32\CoreMessaging.dll
Report Id: ccb8df1c-3147-48a1-9652-f322f8110652
Faulting package full name:
Faulting package-relative application ID:
- If I start the script above, no device plugged, then plug the throttle, I get "Microsoft PC-joystick driver (#1)" and "Microsoft PC-joystick driver (#2) ZRUV", and for #2 all axis values are fine & buttons are detected ok => so far so good
But symetrically to 1), when I plug the stick, nothing appears on #1, only #2 is detected and working properly.
- If I plug both the throttle and the stick, and then start AHK with the script, then it shows both in the tooltip, but no value is detected = no button activity is detected / shown, axis values are only showing X and Y (normal, they are forced in the script), but at 000, and nothing for the others
- If I start the script after plugging only one of the stick or throttle, it acts as 1) or 2) depending on which one I plugged before starting.
Net is that I can only use AHK with buttons of the first one of the two devices I plug, and for that I must pay attention to start AHK before I plug anything, or latest after the first one plugged, else nothing is working at all.
Here I am using it with Elite Dangerous for some buttons on the throttle to manage pips, as the standard Logitech application macros do not work anymore .... https://community.logitech.com/s/questi ... nt-program ...
And no way to have it work with both devices .
Anything I am doing wrong ?
Are there traces I can activate somewhere to give more debug info on what is going on ?
Anything else you would need from me ?