Holding down (typematic repeat)

Bug reports, problems, errors.

Holding down (typematic repeat)

Postby Tranquil.Suit on Thu May 10, 2012 7:41 pm


When you normally press and hold down a key (example z) in Notepad (or even in this posting box on the forums), it will print one ''z' immediately, then after a fraction of a second it will continue printing 'z's (one by one, at a very quick rate).

Now I was expecting the same thing to happen with the code below, when I would press and hold 'b' or 'c'. Instead all three hotkeys (a, b, c), did the same thing (as I pressed and held): Print one letter immediately (in Notepad), and that's it. Repeatedly tapping worked fine (printed a letter with every tap).

Is there any way to do it (what I originally expected)? Am I missing something obvious?

Code: Select all
<Command AutoExec>
<Label R0 Local SendWin R0>
<Run c:\WINDOWS\system32\notepad.exe>
<RenameTargetWin R0>

//1 normal key
<Hotkey a>
<sendLabel R0>
  <Key a>

//2 combine down up
<Hotkey b>
<sendLabel R0>
  <KeyDown b>

<HotkeyUp b>
<sendLabel R0>
  <KeyUp b>

//3 movement hotkey
<MovementHotkey c>
<sendLabel R0>
  <Key c>

Thanks in advance.
Posts: 5
Joined: Wed May 02, 2012 8:20 am

Re: Holding down (typematic repeat)

Postby HotkeyNet on Fri May 11, 2012 1:56 am

The feature you describe is called "typematic repeat." That's what IBM named it in the 1960s when they implemented it for the first time on Selectric typewriters. "Matic" sounded cool and futuristic in those days. Cadillacs used to come with "Hydramatic" transmissions.

Usually people ask here about typematic repeat because they imagine it's used for movement in games. This is seldom the case because the initial delay makes typematic repeat inappropriate for movement.

The reason your script doesn't do what you expect is because <Key>, <KeyUp>, and <KeyDown> perform an action once. For example, <KeyDown> sends a single key press. <Key> sends a single key press followed by a single key release.

If you want to send repeated key presses, you need to execute <KeyDown> over and over. There's a sample script that shows how to do this (the one I wrote) in the following thread:

-- Freddie aka Rob
Site Admin
Posts: 5686
Joined: Fri Mar 28, 2008 8:36 pm

Return to Bugs and problems

Who is online

Users browsing this forum: No registered users and 1 guest