Hi, I wanted to control and manipulate the input of a barcode reader with Keyboard Maestro. Right now it scans with " ̈o" as a prefix, so I can use that in a string trigger. But how can I save the rest of the code in a variable for later use?
I'm not sure if the Typed String trigger can detect the " ̈o" character, but presuming it can, and assuming either the number of characters read is fixed, or there is some trailing character, then you can use the regex variant of the Typed String trigger to capture the whole thing, and then use the TriggerValue token to extract the code.
Hi Peter, thanks for the quick reply! Here is where Im at right now, this displays just the prefix " ̈o" character. To have the regular expression match capturing the whole thing must I also somehow define what comes after the prefix?
Its not fixed length, either it has 5 characters then "-" then 1 to 3 characters or it has 6 characters then "-" then 1-3 characters. Examples 41000-1 or 200100-59. The scanner can be set up to have different pre and suffix, so I can terminate with for example enter.
Could the suffix be set to "#" ?
Then then trigger could be set to " ̈o" + everything until the "#" is typed.
This is then in the trigger value and you can search and replace for " ̈o" and "#".
Then I would set a variable to the %TriggerValue%.
Search and replace for " ̈o" and replace with nothing for that variable. Do the same with "#".
And the do whatever action you need with the variable.
Hi, sorry for the late reply! I managed to get Return in as the suffix. And then try to trigger with [ ̈o.+/r] but it doesn't seem to trigger it and Im also not sure how to proceed with defining the variable via the %TriggerValue%