0
votes

I am rather new to AutoHotKey, so please bear with any idiocy on my part, but I am trying to use at least one of my two mouse buttons (I have a Logitech M570 trackball and am running Windows 10) to perform basically the same function as a prefix key. I just basically want another key that can function like ctrl, alt, windows, fn, etc. I have been attempting to do this on a hotkey-by-hotkey basis, as opposed to just remapping the key itself (I don't want to lose any of the existing shortcuts based on the other prefixes) but for some reason, it doesn't ever work. I don't know if it's something in my trackball settings, or if it's something in AutoHotKey. Here is an example of what I have been trying to do

XButton1 & a::Left
XButton1 & d::Right
XButton1 & w::Up
XButton1 & s::Down

Which is supposed to turn a w s d into the arrow keys while I hold XButton1 down. If anybody has any suggestions on how to resolve this, I would greatly appreciate it.

UPDATE: There is nothing at all wrong with my code. The problem is my trackball. Do not attempt to use a Logitech M570 with AutoHotKey, it is quite aggravating.

HOWEVER, as is noted in the accepted answer, this script will render the key used in the remap useless, so don't adapt this using your LButton instead of XButton1. See the aforementioned answer for a better way to accomplish the same goal.

1
Ty the Send command XButton1 & a::Send {Left}. See also Custom Combinations.user3419297
Your code works for me perfectly. Check that your mouse actually generates XButton1 with KeyHistory. If it does check with a script that has only those 4 lines and when it's the only script running.Oleg
I tried both of those suggestions, but neither of them seemed to work for some reason. Both mouse buttons show up in KeyHistory but neither seem to behave well in Custom Combinations. I have gotten them to run just fine when the mouse button is the only key used when firing the hotkey (a.k.a. key remapping). Thanks for your assistance.ThePiggy
UPDATE: these suggestions work just fine so long as I am not using my Logitech M570 Trackball. I don't recommend buying it if you want to use AutoHotKeyThePiggy

1 Answers

0
votes

I don't know exactly what didn't work for you, but that code will capture every press of XButton1, which is something you might not want. This version should work just fine.

#If GetKeyState("LButton")
a::Left
d::Right
w::Up
s::Down
#If