On 14 Feb 2012, at 15:13, Scott Ribe wrote:

On Feb 14, 2012, at 5:42 AM, Peter Hickman wrote:

It might have some bearing on the solution being offered you would think.

Up to and including "you can't do it that way". It's shocking how many so-called web developers from the Windows side don't realize that in browsers on those other platforms you can't necessarily have arbitrary access to the file system and attached devices--and that this is considered a feature.

I won't do the work the original poster is asking us to do, but there is actually a way to use barcode scanners without having access to attached devices or the filesystem (and it will work on any browser for that matter).

Most barcode scanners support emulating keyboard presses (and send them as if someone would actually type out the number the barcode represents). Some of them even allow you to set a leading character (just some control code) and to end the barcode with some keypress (like ENTER or Return or even a custom random keystroke). You'll have to do your own research to find which ones you can buy where you live and which ones support this feature. On a side node, most local barcode scanner suppliers will be happy to send you a test device if you ask them nicely.

Given that the barcode scanner allows for a leading and a trailing keypress, all that would be required is that the browser window that allows scanning the barcode is the frontmost and active window at all times. Then it's just a matter of writing some javascript code that listens for the keyup event, if the leading control code is sent you start capturing whatever comes next into a javascript variable until it hits the trailing control code, then send that off to the server for processing. If the barcode scanner doesn't allow a leading character, you can just make sure that webpage is just accepting barcode input.

This is as far as I can and will take you. You basically have all the pieces of the puzzle, now it's up to you to find the right device, write the necessary code to capture the device output and make it work with your app. That's part of being a developer: solve problems and come up with a good solution and then actually write the code for it.


Best regards

Peter De Berdt

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
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/rubyonrails-talk?hl=en.

Reply via email to