Most barcode scanners these days have a USB interface. By default, they
operate as keyboard wedge scanners... that is, scanner data appears to have
been typed at the keyboard. You can't really tell the two sources apart.
But your scanner manual probably includes a configuration section where
you can scan special programming barcodes to change settings. Here are two
possible solutions:
1. Configure the scanner to appear on a serial port. You will need to
handle input from this serial port separately from the keyboard (more
coding) but you can keep the two streams absolutely separate. This is the
method I use in my industrial systems.
2. Configure the scanner to automatically append (or prepend) a particular
character to the barcode data. For example, always insert a tilde ~ right
before the enter code at the end of the barcode. Any time you get data,
check the last character. If it's a tilde (or whatever you select), remove
it and treat the data as though it came from the scanner. If there is no
tilde and you don't want the operator to be typing right now, just ignore
the input.
Bob
On Monday, July 23, 2012 12:11:34 AM UTC-5, blm wrote:
>
> On 7/22/12 8:43 PM, Prakash Ranganthan wrote:
> > Hi friends i tried blocking keyboard input but it also blocks barcode
> > input any idea how to proceed with blocking only keyboard input in
> > textbox and allowing barcode input.
> >
> > var barcode = document.getElementById('userid');
> > barcode.addEventListener("keypress", function() { alert("Please use
> > Barcode Scanner!"); document.getElementById('userid').value = "";},
> true);
>
> The barcode readers I've used just generate keystrokes, so as far as the
> browser's concerned, it's all keystrokes. However, the keystrokes from
> the reader usually come quickly and consistently, so maybe you could
> measure the time between keystrokes and differentiate that way.
>
> Of course whatever reader you're using may work differently.
>
> Brian
>
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/greasemonkey-users/-/2GO9mwgTEX4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en.