232key Pro

232Key Pro is a scriptable version of our popular 232key virtual keyboard wedge software. Capture data from a COM port or TCP server, process it with a C# script and send it to any target application as simulated keystrokes.

 

Usage example – counting scale

232key Pro software with Ohaus counting scale

Your counting scale sends the weight, unit weight and quantity to a connected PC. Your script individually processes these values (e.g. for unit conversions). They are then returned to the software as a string which contains both the values and the keys that should be pressed (e.g. the “tab” key to jump to the next input field).

This allows 232key to fill out entire forms with the received data:

Form filled out automatically by 232key Pro

Documentation (work in progress)

As of version 0.5.1, the data is available in the following variables:

  • MatchCollection allMatches: Contains all matches of the regular expression defined in 232key Pro or null if no matches were found.
  • Match firstMatch: Contains the first match of the regular expression defined in 232key Pro (or null if no match was found).
  • String value: A String containing only the value of the first capturing group (or an empty string if nothing was captured).

You can change the regular expression used to match and capture data by clicking on the customize button in the input tab. It should contain one capturing group if you want to work with the value variable (highlighted in blue in the received data in the event log).

This is an experimental early “alpha” release. The functionality is not yet complete and could change significantly in future releases.

Script examples

Output (type) the data exactly as it was captured

return value;

Add line feed (enter) to the captured data

return
value+"\n";

Add tab before the captured data and line feed (enter) after it

return "\t"+value+"\n";

Replace comma with period in captured data, add line feed (enter)

value = value.Replace(',' , '.');
return value+"\n";

Functions

You can call the following functions from your script to simplify common tasks.

NumberFormatter.Format – formats a string as a number

public static string Format(string capturedString, bool useComma, NumberStyles numberStyles)
This function trims white spaces and removes leading zeros. The decimal separator can be set to a dot or comma.
Example conversion: ” –    100000.0 ” is returned as “-100000.0” (with useComma set to false).

Parameters

capturedString String
The string to format as a number (usually data captured from the connected device)
useComma bool
if true, use a comma as the decimal separator. If false, use a point.
numberStyles enum System.Globalization.NumberStyles
NumberStyles to use for formatting (you’ll usually want to use NumberStyles.Number)

Returns

String
Formatted string or original string if number conversion fails.

Examples

Format captured data as number with a comma as decimal separator and return it to 232key Pro
return NumberFormatter.Format(match, true, NumberStyles.Number);