If it seems to be working, that's great.
It wasn't exactly what I had in mind, but if it is functional for what you have, that's what matters.
If you were curious, what I had in mind was something like this for your numbers and Dot.
And then for your NumpadEnter, I was thinking you'd do this:
Code: Select all
$NumpadEnter::
If LastKey
{
LastKeycopy:=LastKey
LastKey:=""
}
Send %LastKeyCopy%`n
Return
You'll notice I shift the clearing of the LastKey to the NumpadEnter, not in each of the Number and Dot hotkeys.
But this behaves
differently from the code you just wrote. In your case, you get to repeat the number one time. In my code, you can repeat the number as many times as you want with every press of NumpadEnter. Whichever behavior you want is totally up to you and neither is wrong.
But to match your behavior, I would use this:
Code: Select all
$NumpadEnter::
If LastKey
{
Send %LastKey%`n
LastKey:=""
}
else
Send `n
return
That will let NumpadEnter repeat the previous number one time, and then it'll send the Enter character
`n otherwise. You could actually rewrite this, because it is OK to have a blank value in a variable in the Send command:
Code: Select all
$NumpadEnter::
Send %LastKey%`n
LastKey:=""
return
If NumpadEnter is pressed two times in a row, then on the second press LastKey will be empty (from the first press) and all that comes out from that is just the
`n.
Again, if your code works, no need to make any changes. You can take what you want from my examples and explanations.