Page 1 of 1

LWin and LCtrl triggered more than once

Posted: 08 Apr 2024, 16:14
by zxyzgt
I am not sure if it is a bug or by design. I have a v2 script below. It simply fires ^c after pressing the hotkey #v. When I checked the key history, I found the LWin and LCtrl were triggered automatically during the execution of the code. However, they are not included in the execution part except shown as the hotkey. Could anyone explain why? Many thanks.

Code: Select all

#Requires AutoHotkey v2.0

#v::
{
	Send("^c")
}
123.png
123.png (39.72 KiB) Viewed 246 times

Re: LWin and LCtrl triggered more than once  Topic is solved

Posted: 08 Apr 2024, 18:01
by gregster
Afaik, this is all by design (since v1.0.x) and intentional to assure that Send works as expected. From the A_Menumaskkey docs (note that Left CTRL is the default menu mask key in AHK) :
https://www.autohotkey.com/docs/v2/lib/A_MenuMaskKey.htm#Remarks wrote:Send: Send, ControlSend and related often release modifier keys as part of their normal operation. For example, the hotkey <#a::SendText Address usually must release the left Win prior to sending the contents of Address, and press the left Win back down afterward (so that other Win key combinations continue working). The mask key may be sent in such cases to prevent a Win or Alt keyup from activating a menu.
Related: Blind mode, DownTemp and generally the Send page.

Re: LWin and LCtrl triggered more than once

Posted: 08 Apr 2024, 20:13
by zxyzgt
@gregster , thank you so much. It is really helpful.
The reason why I am concerning about these mask keys is that sometimes it triggers the pressing of the keys but forgets to release them in v2. For example, LWin is triggered during the execution of the source code but it missed releasing it, which stuck the LWin key for ever. v1 doesn't have this issue though. See my post asking for help below:
viewtopic.php?f=82&t=128376