Forum

Barcodescanner output to string

Hi there,

i have a barcodescanner that behaves like a Keyboard.
I would like to read the scan into a string that can be compared to a list of codes.

Any idea?
Thanks!

Is the scanner like a keyboard would be connected to the OS? Did you try to use the Keyboard node or TypeWriter to receive the code?

@tonfilm Yes, indeed it works with the Keyboard node. I see the numbers coming in one after the other in the Keyboard node. But i would like to see the whole number in a row on the output of the keyboard node.

Configure your reader to send some end of line character for example CRLF and then use a Tokenizer node:
image
If the codes have a fixed length you can also set the Tokenizer to FixedLength:
image

@bjoern Thank you for your reply. As with the output of the Keyboard node i see the numbers flashing up but they dont stay visible in the output of the Tokenizer. I tried it with the fixed length.

Mh, idk and can’t test at the moment. Have you tried the first method? Afair a lot of those scanners are preconfigured to send a Return after the string.

@bjoern It defenetly sends a return because if i read the barcode into a texteditor after reading it jumps into a new line. Maybe i did something else wrong?
Tokenizer

It looks like you just use an IOBox containing the String ‘CRLF’ but you need a CRLF node.

changed that. I dont get any numbers Tokenizer2

Try using CR instead of CRLF. If that doesn’t work, output the string into a texteditor and copy everything from there into an IOBox. Select the IOBox, open an Inspektor and set Show Special Characters to true. What are the characters at the end of the string?

this is at the end of the number :#13#10

Well, that’s CRLF.

Try the attached patch:
Tokenizer.v4p (8.1 KB)

1 Like

Thank you! Works perfect! But why are the numbers now visible? S+H?