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
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:
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.
Output (type) the data exactly as it was captured
Add line feed (enter) to the captured data
Add tab before the captured data and line feed (enter) after it
Replace comma with period in captured data, add line feed (enter)
value = value.Replace(',' , '.');
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).
The string to format as a number (usually data captured from the connected device)
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)
Formatted string or original string if number conversion fails.
Format captured data as number with a comma as decimal separator and return it to 232key Pro
return NumberFormatter.Format(match, true, NumberStyles.Number);