Storing "key presses" (such as TAB) as ASCII Control Characters in barcodes

58k views Asked by At

I'm trying to create a barcode with a "TAB key" within it.

(It seems as though some generators use ~ as a TAB key.)

I've read that Code128 supports ASCII, meaning "HT" should work as a Horizontal Tab. But I can't seem to get it to work.

How do I store a HT character in a Code128 that will decode to a TAB key press?

4

There are 4 answers

0
Terry Burton On BEST ANSWER

Generating a Code 128 containing an ASCII control character

Code 128 can be used to encode any character in the Latin-1 character set, including ASCII control characters (ordinals 0 to 31).

Here is a Code 128 barcode representing a lone HT character (ASCII value 9):

Code 128 of "HT" character

The internal encoding uses code set A and contains these code words:

[103/START-A] [73/HT] [73/check-digit] [106/STOP]

General effect of scanning barcodes containing ASCII control characters

Scanning any type of barcode containing ASCII control characters may not give the intended result due to the diverse ways that the barcode contents may be provided to the system. Each method will provide different ways to configure how control codes are presented to your application.

A hardware reader might be configured in "keyboard wedge" mode where the device emulates a physical keyboard by generating keyboard scan codes. In this case you can usually configure the device to provide specific "key sequences" before and after scanning, as well as provide a mapping from the Latin-1 ordinals (0-255) represented in a barcode to the physical scan codes read by the keyboard interface, For example, in a particular application one might choose to map Carriage Return (ASCII 13) to the Down Arrow (5000) scan code. This text describes the relationship between ASCII control characters and scan codes.

Alternatively a hardware or software reader may use a driver. There is a lot of variation with this approach but often they provide a synthetic RS232 interface (perhaps over USB) or hook into the OLE subsystem of the operating system. In the most basic case scanning a barcode would be equivalent to pasting some text into a textfield – you may require the device/software to perform some kind of translation of the raw barcode data and you may also need to modify the application to react appropriately to the input.

Consider for example that the result of pasting some text containing a HT character into a text field isn't necessarily the same as manually typing that same text on the keyboard, i.e. at some point actually pressing the TAB key. When pasting the text the result would likely be that the initial field would contain the full text including the literal HT character. When typing the text manually the result would likely be that the leading input goes into the initial field, then the TAB key-press results in a change of focus to the next field in the tab order, which the remainder of the text will populate.

A barcode reader's documentation should describe the interfaces available and methods for customising the presentation of scanned data.

0
chris On

I am having the same issue.. try to open notepad make your text example:

1 (press tab) 1 (press tab)(press tab)1

then select copy and paste. into your label software . format 128auto

it works fine.

2
Jeff Nichols On

@terry-burton - You gave an excellent response for the answer. Your write up provided me direction to where I needed to look for my answer. To solve my problem, and possibly to answer @nir-tzezana question, I found my answer in the scanner's documentation.

Correct barcode - I first ensured that my code128 was properly formatted and included the ASCII code for 'tab'. In my situation I have a number of tabs set inside a large string so I can quickly scan one barcode code and have multiple cells in excel populated.

Enable Function Key Mapping - Our environment uses Symbol LS2208 scanners. I obtained this manual and printed manual the page 7-14. In particular, I needed to enable 'Enable Function Key Mapping' on the device. If you refer to the table found on page 7-15 you'll see that the 'tab' key can be overused depending on the scanner setting. By making this change my scanner can now successfully parse the following string into correct cells.

Example:

MyCode128Function("Text123".Chr(9)."Text456".Chr(9)."Test789")
0
Rassal KP On

Please try use ^K for horizontal tab. Hope it should work