Why does ErrorLevel for Input command treat dots input in different way as different symbols?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
-_+
Posts: 70
Joined: 06 Dec 2014, 12:43

Why does ErrorLevel for Input command treat dots input in different way as different symbols?

26 May 2016, 14:47

This script is supposed to msgbox errorlevel whenever the user inputs a dot.

Code: Select all

Loop
{
	Input, key, C L1 V, .
	If (ErrorLevel == "EndKey:.")
		MsgBox, % ErrorLevel
}
But it doesn't do so if the user inputs a dot
- using NumpadDot (when NumLock is On);
- from non-english keyboard layout.

A dot is just an example, I've also noticed that question mark character has the same issue when being input from non-english keyboard layout.

I tried to use StringCaseSense, Locale, but that didn't help.

Why is it working this way?
I'd like all dots (irregardless of the way they were typed from keyboard) trigger the msgbox in the above script.
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Why does ErrorLevel for Input command treat dots input in different way as different symbols?

26 May 2016, 15:47

For NumpadDot:

Code: Select all

Loop
{
	Input, key, C L1 V, .{NumpadDot}
	TrayTip, Key, % key "`n" ErrorLevel
	If (ErrorLevel == "EndKey:." || ErrorLevel == "EndKey:NumpadDot")
		MsgBox, % ErrorLevel
}
I didn't test the non-english keyboards, but maybe try using the Vk code as described in the EndKeys section and/or use the "E" option: https://autohotkey.com/docs/commands/Input.htm
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Why does ErrorLevel for Input command treat dots input in different way as different symbols?

26 May 2016, 18:40

Just use the E option.
E [v1.1.20+]: Handle single-character end keys by character code instead of by keycode.
-_+
Posts: 70
Joined: 06 Dec 2014, 12:43

Re: Why does ErrorLevel for Input command treat dots input in different way as different symbols?

26 May 2016, 18:47

Thanks. Why can't I use as a value for EndKeys argument?
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Why does ErrorLevel for Input command treat dots input in different way as different symbols?

26 May 2016, 19:41

I guess there are a few possible answers.
1. is not a key.
2. You have a key labelled , but it actually just simulates . three times.
3. You're actually just typing . three times and a program (like MS Word) is auto-correcting it to . AutoHotkey detects only what you type.
4. You most certainly can use as a value for EndKeys. Whether it will do what you want is a separate matter.
5. Something else.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], mcd and 186 guests