The code is certainly doable, but I don't think it's ever been done before. It must work on the following principle;
a) activates at the moment the first key is pressed or input received
b) starts a timer at the moment of activation
c) check the speed at which inputs are received (inputs/time)
d) it recognizes the barcode by determining the speed of the input
e) it stores the barcode in a variable/text file
f) the system must run in the background and allow normal barcode input into applications
g) the system must have an option, not store strings which contain certain chars
Below is the code I was dabbling with, which does not measure time and speed of input but only the length of the string obtained before a timeout. It is inefficient.
The first code uses a timer;
Code: Select all
#SingleInstance force
#Persistent
SetTimer, BarcodeCaptureTimer, 250
return
BarcodeCaptureTimer:
BarcodeCapture :=
Input, BarcodeCapture, I V T0.5
StringLen, BarcodeLength, BarcodeCapture
If BarcodeLength > 5
{
FileAppend, %BarcodeCapture%, %A_Desktop%\BarcodeCapture.txt
}
If BarcodeLength < 5
{}
Return
Code: Select all
#SingleInstance force
Loop
{
GoSub, BarcodeCaptureTimer
}
BarcodeCaptureTimer:
BarcodeCapture :=
Input, BarcodeCapture, I V T2
StringLen, BarcodeLength, BarcodeCapture
If BarcodeLength > 5
{
FileAppend, %BarcodeCapture%, %A_Desktop%\BarcodeCapture.txt
}
If BarcodeLength < 5
{}
Return