I've got a set of flight pedals with toe brakes, and I thought it'd be fun to use those brakes to toggle controls, specifically jump jets and MASC.
So I managed to find an autohotkey script online that dealt with joysticks, and hack it to do what I want: it maps the toes (which are are analog devices like a joystick) to key presses. I'd not use autohotkey, but the pedals' programming software doesn't allow mapping key presses to the pedals.
It works well enough that when I go into the MWO keyboard settings, I can, for example, select MASC, and when I press one of the toes, the key I have mapped to it, 'P', is detected by MWO and entered as the setting for MASC. Same for jump jets - in the keyboard settings screen, MWO sees me hit the toe and detects the O key.
But, when I actually enter a match, MWO does not pick up the toe pedal presses (yes, everything is mapped correctly - I can press O or P on the keyboard, and the corresponding function activates).
Anyone with ideas? Here is the script:
EDIT: Things are working now. Here is the script in case someone is interested.
; Recommended for performance and compatibility with future AutoHotkey releases.
#NoEnv
; Enable warnings to assist with detecting common errors.
;#Warn
; This makes the "F12" key turn the script on and off as needed.
;F12::Suspend
; Recommended for new scripts due to its superior speed and reliability.
SendMode Input
; Ensures a consistent starting directory.
SetWorkingDir %A_ScriptDir%
#InstallKeybdHook
#SingleInstance force
; Set this to the pedals' Joystick number, as enumerated by windows.
joystickNumber = 1
; Threshold at which the a toe pedals' function will engage. That is
; if a toe pedal's position is greater than this, it will engage, less
; than this, it will disengage.
pedalPositionThreshold = 20
; These are set to true if on the previous trip through the loop
; the X or Y pedal was pressed past the threshold.
wasXPressed = 0
wasYPressed = 0
; These hold the position of the X and Y pedals on the current trip
; trip through the loop.
joyXPosition = 0
joyYPosition = 0
Loop
{
; Read state of pedals. Pedals seen as a joystick, with one toe brake as X axis, the
; other as Y axis. The main pedal function would be seen a "R" axis, I think, but it's
; not used here.
GetKeyState, joyXPosition, %JoystickNumber%JoyX
GetKeyState, joyYPosition, %JoystickNumber%JoyY
; If X axis pedal is pressed past the threshold, hold the specified key down.
if joyXPosition > %PedalPositionThreshold%
{
Send, {o Down}
wasXPressed = 1
}
; If X axis pedal is released such that it is not past the threshold, release the key.
if joyXPosition <= %PedalPositionThreshold%
{
; Don't send the up key unless the pedal was pressed the last time through the loop.
; I.e don't send up unless the a down has been sent.
if (wasXPressed == 1)
{
Send, {o Up}
wasXPressed = 0
}
}
; If Y axis pedal is pressed past the threshold, hold the specified key down.
if joyYPosition > %PedalPositionThreshold%
{
Send, {p Down}
wasYPressed = 1
}
; If Y axis pedal is released such that it is not past the threshold, release the key.
if joyYPosition <= %PedalPositionThreshold%
{
; Don't send the up key unless the pedal was pressed the last time through the loop.
; I.e don't send up unless the a down has been sent.
if (wasYPressed = 1)
{
Send, {p Up}
wasYPressed = 0
}
}
; Sleep for 100 ms every time through the loop.
Sleep, 100
}
return
Edited by Kragg Relluf, 21 September 2015 - 03:31 PM.



















