Sending AppleScript Array Values as Midi Messages

Hi all,

I'm completely new to KM and about evaluating if this application may help me with the following:

I have this Applescript, which should repeat once a second:

tell application "System Events"
   tell application process "Pro Tools"
      
      set listOfSelTracks to value of attribute "AXIndex" of ¬
         (rows whose value of attribute "AXSelected" is true) of table "Track List" of ¬
         (windows whose name contains "Edit: ") of ¬
         application process "Pro Tools" of application "System Events"
      
      return listOfSelTracks
      
   end tell
end tell

This returns an array of integers, for example {{2,4,9}}. The size of the array will vary. The integers will be something between 0 and 127.

Now I would like to send those integers one by one as a Midi Note On command.

My questions: is it possible to store the integers of the array as a KM variable and how can I use those variables to create a Midi message?

Thank you for your help.
Stefan

Given a note in variable “Note”, you can send the note on MIDI message with the Send MIDI Note On action:

To iterate through the text “{{2,4,9}}”, you could use the For Each action with the Substrings In collection matching regex “\d+”.

Hi Peter,

Great thank you. Will have a look!