Page 1 of 1

Difference between Send and remapping

Posted: 22 Oct 2019, 08:59
by john_c
Can anybody show the difference between Send and remapping? Can we say that one approach is generally better than another?

Code: Select all

a:: Send, b
b:: MsgBox,,, % "B"

x:: y
y:: MsgBox,,, % "Y"

Re: Difference between Send and remapping  Topic is solved

Posted: 22 Oct 2019, 09:18
by gregster
Important formal difference that is often not clear to people: wrote:When a script is launched, each remapping is translated into a pair of hotkeys. For example, a script containing a::b actually contains the following two hotkeys instead:

Code: Select all

SetKeyDelay -1   ; If the destination key is a mouse button, SetMouseDelay is used instead.
Send {Blind}{b DownR}  ; DownR is like Down except that other Send commands in the script won't assume "b" should stay down during their Send.

*a up::
SetKeyDelay -1  ; See note below for why press-duration is not specified with either of these SetKeyDelays.
Send {Blind}{b up}

Then, in practice (among other implications): wrote:[...] a remapping never "releases" the modifier keys which are used to trigger it. For example, A::b is typically equivalent to A::B and ^a::b is equivalent to ^a::^b. This is because each remapping internally uses {Blind} to allow the key or key combination to be combined with other modifiers.
Now compare

Code: Select all


Code: Select all

a::Send b
Press, for each variant, a and Shift+a and watch the difference...

People usually wonder especially, why pressing Ctrl+a doesn't return b but ^b, when using ^a::b.
^a::Send b on the other hand...

Re: Difference between Send and remapping

Posted: 22 Oct 2019, 11:48
by john_c
Thanks, it's clear.