*a::
SetKeyDelay -1 ; If the destination key is a mouse button, SetMouseDelay is used instead.
Send {Blind}{b DownTemp} ; DownTemp is like Down except that other Send commands in the script won't assume "b" should stay down during their Send.
return
*a up::
SetKeyDelay -1 ; See note below for why press-duration is not specified with either of these SetKeyDelays.
Send {Blind}{b Up}
return

Normally, Send {b Down} would cause subsequent Send commands to leave b down. So for instance, if b is Ctrl, Send {Home} would result in Ctrl+Home instead of just the expected Home. DownTemp is used to prevent this, so Send will automatically release the key before-hand, as it would if you were physically holding the key. However, because the key isn't physically down, Send doesn't restore it to the "pressed" state afterward. (Generally, if a key had been physically released during Send, it would be bad to automatically put it back in the pressed state.)

There are probably better ways to implement remapping, but this is what we have. I have no plan to improve on it, but anyone is welcome to try.

SendInput and SendPlay use a different (simpler) code path for restoring modifiers than SendEvent, because all events for that call are determined at the beginning, before the user has any chance to interfere with the modifier state. DownR was only implemented for the SendEvent code path.