top of page
Search
  • Writer's pictureYun'Harla

AutoHotkey: Map 1 key to 2 keys


Mapping keyboard keys is a typical feature gaming keyboards provide. However, do they really fulfill the seemingly 'simple' task of mapping 1 key to 2?


Turns out Razer's Synapse (software) is unable to do it!



To clarify the actual task/mapping, we not looking at a simple case of making holding 'a' key become typing 'bcbcbcbcbc'. Instead, we want to achieve this 'advanced' mapping of:


Left Shift key down => Left Shift key down & Space key down (Hold) Left Shift key up => Left Shift key up & Space key up (without 'repeat' of either key)

Simple Mapping

Typing & holding 'a' becomes typing 'bcbcbcbc'.

This can be fulfilled by in Razer gaming keyboard using Synapse's Macro Programming. Steps:

  1. Record a macro to capture keystrokes: 'bc'.

  2. Assign the macro to 'a' key.

The macro actually records these steps:

  1. delay + b down

  2. delay + c down

  3. delay + b up

  4. delay + c up

You can duplicate the macro and delete the up and down entries in separate macros and try to map like 'a' to 'bc down' and 'b' to 'bc up', but they don't work well - keys will be 'jammed'.


Advanced Mapping

Pressing & holding 'Left Shift' becomes holding 'Left Shift + Space'.

For this, I've tried 2 ways folks suggested in AutoHotkey. AutoHotkey is a powerful software to remap keys using a custom script definition.


Testing Your Mapping

A good way to test your mapping is to use Microsoft's Keyboard Ghosting Demo webpage.

It shows a live view of keyboard graphic showing which keys are being held down.


Method 1 Script

*LShift::Send {Space down}{LShift down} *LShift Up::Send {LShift up}{Space up}

This kind of works - it does press both Left Shift key and Space key.

However, on closer inspection in Ghosting test page, if you press and hold 'Left Shift key', what happens is:

  1. Left Shift key down + Space key down

  2. (Hold): after a while Left Shift key up + Left Shift key down

  3. Above repeats, until Left Shift key is released

  4. Left Shift key up + Space key up

Essentially when holding the trigger key of Left Shift, 'key repeat' feature kicks in! Though, it happens only to the trigger key of Left Shift and not Space key. If you need a true 'key down and hold' in gaming, this method 1 does not work well.


Method 2 Script

$LShift:: Send {Space down} Send {LShift down} KeyWait, LShift Send {LShift up} Send {Space up} return

The above eliminates the 'key repeat' problem of method 1, by using 'KEyWait' keyword to wait for LShift release (up) to send the key up's once. Thus, it does not trigger 'key repeat'.


Conclusion

If mapping 1 key to 2 keys for gaming use, use method 2 for AutoHotkey to avoid 'key repeat' problem.


Recent Posts

See All
Post: Blog2_Post
bottom of page