Capture the weight from a scale with differentiated digits

This article describes how you can capture the weight from a weighing instrument with differentiated digits using 232key Plus.

What are differentiated digits (a.k.a. “auxiliary indicating device”)?

When looking at the display of an approved class I or class II weighing instrument, you might notice that one or more digits are visually differentiated from the others:

A&D EK-610i approved class II weighing instrument

This is supposed to remind the user that on these instruments, the actual scale interval (d) is a multiple of the verification scale interval (e). For the scale shown above, e is 0.1 g and d is 0.01 g. Since e is used to determine the maximum permissible error, we can consider the differentiated digit(s) to be less accurate (but that’s not the topic of this article).

How to use 232key to capture differentiated digits

Some scales do not only visually differentiate the last digit(s), they also use a separator when transmitting them to a PC (or a printer). Instead of receiving a string like “250.01”, the software running on the PC would receive something like “250.0/1” or maybe “250.0[1]”.

As far as our virtual keyboard wedge software 232key is concerned, this additional separating character will prevent it from capturing the entire weight value. Instead, it would only capture “250.0” (highlighted in blue in 232key’s event log):

232key event log: differentiated digit not captured

Fortunately, you can easily fix this in the Plus version of our software in just two steps.

1. Modify the regular expression to ensure all required characters are captured

Let’s continue using “/” (slash) as a separator for this example. By default, most device profiles in 232key are meant to capture numbers and therefore 232key will stop capturing when it encounters the first non-numeric character. We have to change this behavior to make sure that 232key captures the digits preceding the separator, the separator itself and the following digit(s).

To do so, we first select the device profile we want to use (we’ll go with “Generic measurement instrument” in this example), and then click on the “Customize…” button to open the regular expression dialog:

232key: Regular expression dialog

The current regular expression captures the first number it encounters (which can be positive or negative and have a dot or comma as a decimal separator):

([-+]?\s*[0-9]*[\.,]?[0-9]+)

By expanding it as below we can instruct 232key to match a slash (“/”) and the following digits, too:

([-+]?\s*[0-9]*[\.,]?[0-9]+/[0-9]+)

Depending on the selected device profile, the regular expression shown in the dialog might look different. What’s important is that it has to be expanded to include the separator and the differentiated digits.

2. Remove the separator

Thanks to the modified regular expression, 232key is now able to capture the entire value sent from the scale, including the separator. However, it would then either show a number format error (if we’ve selected a numeric device in the input tab) or type the data including the separator into the target application (if we’ve selected a text device). Both of these outcomes are not desirable.

Therefore, we also have to instruct 232key to remove the separator from the captured data by going to the “Process” tab and entering it in the “Remove” text field:

232key process tab: remove separator

Once this second step is completed, 232key handles differentiated digits correctly: When the scale sends “250.0/1”, 232key types “250.01” into the target application (e.g. a spreadsheet):

Weight typed into spreadsheet

Obviously, you might have to adapt these instructions to match the separator sent by your scale. As mentioned, you’ll also need a paid 232key Plus license to enable the functionality shown in this article. Please don’t hesitate to contact us should you need a trial license. For assistance, please email us or post in our support forum.

Leave a Reply

Your email address will not be published. Required fields are marked *