Keyboard filter for Toddlers

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Guest

Keyboard filter for Toddlers

10 Sep 2018, 12:30

I am trying to write a simple keyboard mapper for toddlers, which will make any keystroke send a simple {enter}.
First try:

Code: Select all

input:=""
	Loop
	{
		Input, in, L1
		Send {enter}
	}
When hitting the keyboard fast enough), some keystrokes are missed and send as-is.

Second try:

Code: Select all

input:=""
	Loop
	{
		Input, UserInput, T0.2
		if (UserInput != "")
		{
			Send {enter}
		}
	}
Still, some keystrokes are missed.

Any suggestions or thoughts?

Thanks!
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Keyboard filter for Toddlers

10 Sep 2018, 12:37

Not sure I understand the point; what value does this have for a toddler?

Remove the timeout completely and use the limit option. Set the limit to 1, and you should be good to go. Note that this does not pick up every key pressed, only keys that output characters (F-keys, arrow keys, etc. will be missed).
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
Guest

Re: Keyboard filter for Toddlers

10 Sep 2018, 12:49

Masonjar13 wrote:Not sure I understand the point; what value does this have for a toddler?
I want the toddler to be able to view a presentation, where he/she can go to the next slide by pressing any key.
Masonjar13 wrote:Remove the timeout completely and use the limit option. Set the limit to 1, and you should be good to go. Note that this does not pick up every key pressed, only keys that output characters (F-keys, arrow keys, etc. will be missed).
This was the first solution I tried, as mentioned in the OP, and it misses some simple keystrokes when repeated quickly.
Guest

Re: Keyboard filter for Toddlers

10 Sep 2018, 12:55

Thanks. This solution disables some keys using keyboard mapping. I looked into that option, but it does not seem very elegant. You have to list every single key... your script becomes 100+ lines long instead of <10 lines. Do you think this is the optimal solution?
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Keyboard filter for Toddlers

10 Sep 2018, 13:08

You're right, I missed that. You could try setBatchLines -1 to speed things up, as well as using SendInput. The most effective method would be to list all keys in an array (can be on the same line), then loop through them to create a hotkey for each, then direct them towards a label that sends enter. That definitely wouldn't miss anything. Example:

Code: Select all

keys:=["a","b","c"]

for i,a in keys
    hotkey,% a,sendit
return

sendit:
sendInput {enter}
return
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Keyboard filter for Toddlers

10 Sep 2018, 13:10

You could set up your own keyboard hook (search for WH_KEYBOARD_LL). Then you can have it trigger on each (down) event. Using Input in a loop just won't cover it, because it's just not monitoring 100% of the loop execution.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Keyboard filter for Toddlers

10 Sep 2018, 13:21

Do you think this is the optimal solution?
No, I misunderstood the purpose of your script.
skrommel's script is not doing what you want. I only use it when I clean my keyboard.
I have no access to toddlers, :lol:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 113 guests