I'm having issues with MIDI triggers. I want to look for packets as a trigger. They appear as hex - three sets of two characters - and when using MIDI Learn appear with a "^" character at the top, thus: ^9B 01 7F$
I want to extract the middle pair, here represented as 01, and set a variable to that value. Have not been able to do so. I'd thought that using the token for Tripped Trigger Text or Tripped Trigger Value would work, and that I could just use TriggerValue[2], but this hasn't worked. And I get no response from these macros when in the application they are active in. I can use MIDI learn, so data from my trigger source reaches KM, and I can see data from the trigger source reaching the sequencer I use. But when I am using the sequencer, the data no longer appears to reach KM. Is it common to need an external patchy app or to use IAC to duplicate the MIDI from a remote so it will go to both places, or shouldn't KM see what's going to the sequencer also?
When using a regular expression (regex), the ^ indicates the beginning of the string, and the $ the end. I am not actually sure right now why those values would be included in this context, but I trust that there will be a good reason for it!
I think you are on the right lines with your thinking. I have just put together this little demo. The regex in the Search Text action matches a group of characters with spaces either side, so works to extract the byte that you want.
Ah, you mean the text in the %TriggerValue%? Your guess is sensible and I'll experiment further to try to understand why that shouldn't work.
By "the sequencer" I presume that you mean some piece of software running on the same Mac. In the trigger section of the demo macro, if you click on "from: any device", you will see a list of MIDI that devices that KM knows about. You will need to make sure that there is a route from your sequencer's MIDI output to KM. This is not a limitation of Keyboard Maestro; no app will know about MIDI that is not routed to it. IAC may well be a suitable solution.
Edit: rereading your post, I think what you are saying is that incoming MIDI is seen by the macro except when the sequencer app is running. That suggests that incoming MIDI is being grabbed by the sequencer software before KM can access it. You could perhaps first see if there is a way for the sequencer to pass incoming MIDI through to IAC. Otherwise something like MIDIPipe might do the trick.