Tech Tips

Mapping USB Gamepad Buttons to Keyboard Maestro Macros

I like to use a USB gamepad to control things on my Mac using Keyboard Maestro. Some gamepads are detected by Keyboard Maestro better than others. Keyboard Maestro cannot detect the up, down, left, right buttons on my EvoRetro SNES USB gamepad.

USB gamepad

Using Enjoyable, you can map these KM-undetectable buttons another key, but Enjoyable doesn’t allow modifiers. So, you cannot set the left hat switch button to ctrl-alt-shift-g  for example. You can set it to g  or F12  without issue.

There is a workaround, of course, to set a non-conflicting key mapping. Read on to learn how.

We don’t typically have F13+  keys on Mac keyboards. So, we can use these safely without conflicts in Keyboard Maestro. The issue is, you cannot hit F13  while in Enjoyable (because your keyboard likely doesn’t have that key). You can, however, use this AppleScript to trigger that keystroke.

To use this, open Script Editor, paste in the code, run the script, then click into the Enjoyable field where you type the key, then wait… it’ll type the F13  keystroke for you.

Example of mapping F17 in Enjoyable

The full list of F13+  keys is here:

After you’ve set the button in Enjoyable, you can just hit the gamepad button in a normal “Hot Key” trigger in Keyboard Maestro and it’ll detect the F13 . Don’t forget to **Mappings > Enable** in Enjoyable.

Keyboard Maestro mapping usb gamepad hotkey

The other keys on this gamepad seem to be detected by Keyboard Maestro with the USB Device Key Trigger so there is no need to deal with those via Enjoyable.

 

Leave a Reply

Your email address will not be published. Required fields are marked *