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.
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