Difference between Send and remapping Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
john_c
Posts: 318
Joined: 05 May 2017, 13:19

Difference between Send and remapping

22 Oct 2019, 08:59

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"
gregster
Posts: 3275
Joined: 30 Sep 2013, 06:48

Re: Difference between Send and remapping  Topic is solved

22 Oct 2019, 09:18

Important formal difference that is often not clear to people:
https://www.autohotkey.com/docs/misc/Remap.htm#remarks 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

*a::
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.
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

Then, in practice (among other implications):
https://www.autohotkey.com/docs/misc/Remap.htm#Remap 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

a::b
and

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

Return to “Ask For Help”

Who is online

Users browsing this forum: Bpd, Chunjee, DRocks, KilliK, Odlanir, toralf and 73 guests