Hi all,
I have a keyboard and barcode scanner. I need to distinguish between keystrokes of the keyboard and those "keystrokes" produced by the barcode scanner.
To tell them apart, I want to measure the time between all keystrokes, and when they are below a certain threshold (<~50ms), to collect them to build up a "scanned input" string.
Since I know how long the scanned inputs are, I know that if I don't reach that length whilst maintaining a certain minimum time, that the input is from the keyboard and I can dump the string... and go back to square 1.
Basically:
If KeystrokeTime - PreviousKeystrokeTime < 50ms then ScanString = ScanString+Keystroke
Else
ScanString = ""
yada, yada...
The problem is that the timing has to be measured while an InputBox is open... which I think is going to prevent this from working
Thank you for your kind help.
R
Measuring the time between keystrokes Topic is solved
Re: Measuring the time between keystrokes Topic is solved
You can save the A_TickCount so that you can compute differences.
Re: Measuring the time between keystrokes
I found that indeed A_TickCount does work in this application...mikeyww wrote: ↑04 Oct 2022, 17:11You can save the A_TickCount so that you can compute differences.
However, I was able to take a different approach when I realized that I didn't actually need the measurement, and that in actuality all I needed was a countdown timer implementation, and made various use of SetTimer.
I continue to be impressed with how versatile AHK is... generally several ways to skin any cat.
Thanks for your kind help!
R