The attached file shows how you can do this and is using it using a simple serial loopback.
The first translator sends the message to COM1 when you push a MIDI note 0 on my controller.
The second translator is what you are looking for. It looks at the incoming message and when it sees “1.05” it will capture the digits. I use this message since it is easier to delimit the pattern that includes the quote marks.
1 become local variable “oo”, 0 becomes the local variable “pp” and 5 becomes the local variable “qq”
Then in rules I subtract 0x30 to get the decimal value for each variable (which is sent as ASCII coding).
For oo, I then multiply times 100
For pp, I multiply by 10
Then I add the values together to get the final value of rr (105).
I have logging on in rules so you can see in the log window the result.
Here are the rules:
Log "Message Received oo=%oo% pp=%pp% qq=%qq%"
oo=oo-0x30
oo=oo*100
pp=pp-0x30
pp=pp*10
qq=qq-0x30
rr=oo+pp
rr=rr+qq
Log "Final Number is %rr%"
And the results:
1: IN 0.0 Note On on ch. 1 with note:0 (0x00) and velocity:127 (0x7F)
2: OUT 0.0 wrote set MTX:mem_512/60000/0/0/0/0/0 0 0 105 “1.05” to COM1 [Serial]
3: IN 0.1 Serial Port: 73 65 74 20 4D 54 58 3A 6D 65 6D 5F 35 31 32 2F 36 30 30 30... from COM2 [Serial2], oo=0x31 pp=0x30 qq=0x35
4: 0.1:2 Message Received oo=49 pp=48 qq=53
5: 0.1:13 Final Number is 105
Serial ports are set up with aliases as follows.
I’m using a comOcom virtual serial loopback pair for testing.
Thank you for your fast reply. I understood your example but the next problem is that the important positions are changing.
Here is an example of a full set ob messages:
Log "Message Received oo=%oo% pp=%pp% qq=%qq%"
if qq==32 then Goto "Two"
if pp==32 then Goto "One"
if qq!=0 then Goto "Three"
//two digit
Label "Two"
oo=oo-48
oo=oo*10
pp=pp-48
rr=oo+pp
Log "ONE: Final Number is %rr%"
exit rules, execute Outgoing Action
//three digit
Label "Three"
oo=oo-48
oo=oo*100
pp=pp-48
pp=pp*10
qq=qq-48
rr=oo+pp
rr=rr+qq
Log "Two: Final Number is %rr%"
exit rules, execute Outgoing Action
//one digit
Label "One"
rr=oo-48
Log "THREE: Final Number is %rr%"
Yes something like that should do it. However I’m thinking with a loopback on the same device which I have it gets a little honky with the timing of the messages. You may just want to configure the receive portion.
I’ve configured it to read the 3 digits before the quotes, so less conversion is needed.