Send command sends ctrl unintentionally

Get help with using AutoHotkey and its commands and hotkeys
Leli196
Posts: 215
Joined: 29 Aug 2015, 05:47
Location: Germany

Send command sends ctrl unintentionally

02 Dec 2017, 12:42

Hi there,

I have a problem with the Send commands. They send the control key although they shouldn't. Only now I really recognized this behaviour, but it was always present.

Maybe it is just a mistake by me in some way. However, using this code (in two different scripts) shows that the Send commands in fact send the control key at my machine, even when they should only send a few letters:

Code: Select all

#SingleInstance

Loop {
	if (GetKeyState("Control") && !GetKeyState("Control", "P"))
		IniWrite, Ctrl , test.txt, test
}

Code: Select all

#SingleInstance

!a:: SendInput, Test
Pressing Alt+a at my computer generates one new entry in the test.txt nearly every single time.

When I use the following code instead, pressing Alt+a generates even two or three new entries nearly every single time.

Code: Select all

#SingleInstance

#IfWinActive A

!a:: SendInput, Test

What is happening here? Is it a bug in the AutoHotkey.exe, am I doing something wrong, is it only a bug at my computer and not occuring at your computers?

Thanks in advance for any help! :thumbup:
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Send command sends ctrl unintentionally

02 Dec 2017, 13:39

- AFAIK, AltGr (RAlt, i.e. right alt) sends Ctrl+Alt, whereas Alt (LAlt, i.e. left alt) just sends Alt.
- Go to the AutoHotkey main window, by double-clicking the tray icon, go to 'View, Key history and script info', and try pressing buttons and seeing what comes up.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Helgef
Posts: 4678
Joined: 17 Jul 2016, 01:02
Contact:

Re: Send command sends ctrl unintentionally

02 Dec 2017, 13:47

Please see #menumaskkey. You could use keyhistory instead of the ini-file.

Cheers.
Leli196
Posts: 215
Joined: 29 Aug 2015, 05:47
Location: Germany

Re: Send command sends ctrl unintentionally

02 Dec 2017, 22:23

Thanks! I did not use AutoHotkey for a while and forgot about KeyHistory :shock:. So this made it pretty clear, that the Ctrl keypresses were masking the Alt and Win keypresses, like documented at #MenuMaskKey.

The problem with the Ctrl keypresses is that I use the option of Windows to show me the cursor's position when pressing Ctrl and it gets activated all the time with the relevant hotkeys.

Now I seem to have two options: Either change #MenuMaskKey to any non-existent key like vkFF, or change it to any existent but rarely used key like Help. Are there any differences between these two options regarding compatibility? When testing in SciTE4AutoHotkey both methods work, but there might be other applications or games that have problems with either one.

Return to “Ask For Help”

Who is online

Users browsing this forum: andymbody, bartolllomeo, HiSoKa, rawskull7, Skrell, twiz, whereyomomsat_ and 49 guests