Python-rtMIDI & AppleScript/JavaScript

Not really a question about Open Stage Control, but as I’ve come to understand, the software makes use of this Python-rtMIDI thingy. Hoping that someone would be willing to share some perspective, I’m asking this: Is it possible to trigger a MIDI note message with Applescript (or Javascript) through Python-rtMIDI? I’m trying to write a script that interacts with the GUI of my DAW (clicks, drag&drop mouse actions, keystrokes) and here and there I’d like to add lines that can trigger a MIDI note message.

Example (applescript):

-- delay variables
set delayOne to 0.1
set delayTwo to 0.3

-- click before drag
set firstX to 544
set firstY to 48
do shell script "eval $(/usr/libexec/path_helper -s); cliclick dd:" & firstX & "," & firstY
delay delayOne

-- drag to new location and release
set secondX to 507
set secondY to 287
do shell script "eval $(/usr/libexec/path_helper -s); cliclick du:" & secondX & "," & secondY
delay delayTwo

-- send MIDI note message with Python-rtMIDI
port
note
channel
velocity

Thank you!

You can send midi messages directly from the custom modules, I don’t think there any interest in doing it from an applescript subprocess. It seems you’re only using applescript to call shell scripts, which you can already do in the custom module

var { exec } = nativeRequire('child_process')

// etc..