Write automation for multiple VSTi

I have a MIDI controller with a lot of encoders that is normally connected via MIDI Remote.
In this one particular project however, I would like to use the controller to write VST automation on 2-3 Instrument Tracks at the same time. What is the easiest way of accomplishing that?

Hello my friend, the easiest way I can think of is to assign your knobs to the instrument quick controls (per bank) of channels 1 to 3 of a mixerBankZone. This means that you have to manually move the tracks you want to the top of your bank.

Now, if you want to freely select tracks to automate in a bank zone (by having buttons to select the channels to automate up to a max number), here’s a not tested snippet that may give an idea:

var midiremote_api = require('midiremote_api_v1')

var deviceDriver = midiremote_api.makeDeviceDriver('Test', 'Test', 'Someone')

var midiInput = deviceDriver.mPorts.makeMidiInput("anInput")
var midiOutput = deviceDriver.mPorts.makeMidiOutput("anOutput")

var detectUnit=deviceDriver.makeDetectionUnit()
detectUnit.detectPortPair(midiInput,midiOutput)
    .expectInputNameEquals("an input port")
    .expectOutputNameEquals("an output port")

var surface = deviceDriver.mSurface
var bankChannelsCount=8//Our bank's number of channels
var qcCount=8//Number of real controls for each channel 
var maxAutoChannels=2//Number of max channels we want to automate

if(maxAutoChannels>bankChannelsCount){

    maxAutoChannels=bankChannelsCount

}

var initCC=16//A base CC for our midi messages, done it just to loop, in a real implementation it will obviously differ

var autoChannelSelectors=[]//The buttons we will use to select/deselect channels to automate
var knobs=[]//Our "physical" knobs
var customAutoVars=[]//These will be bound to the instrument quick controls for all channels of our bank
var selectedChannels=[]//This holds the selected channels 

for(var i=0;i<bankChannelsCount;i++){

    for(var j=0;j<qcCount;j++){

        var cc=i*qcCount+j+8+initCC

        if(i<maxAutoChannels){

            var knob=surface.makeKnob(j,i,1,1)
            knob.mSurfaceValue.mMidiBinding
                .setInputPort(midiInput)
                .bindToControlChange(0,cc)
            
            knobs.push(knob)
    
        }
    
        var customAutoVar=surface.makeCustomValueVariable("customAutoVar"+cc)
        customAutoVars.push(customAutoVar)
    
    }

    var autoChannelSelector=surface.makeButton(i,maxAutoChannels,1,1)
    autoChannelSelector.mSurfaceValue.mMidiBinding
        .setInputPort(midiInput)
        .bindToControlChange(0,i+initCC)

    autoChannelSelectors.push(autoChannelSelector)

}

var page=deviceDriver.mMapping.makePage("qc")
var mixerBankZone=page.mHostAccess.mMixConsole.makeMixerBankZone("mixerBankZone")
mixerBankZone
    .excludeInputChannels()
    .excludeOutputChannels()
    
var mixerChannels=[]
for(var i=0;i<bankChannelsCount;i++){

    var mixerChannel=mixerBankZone.makeMixerBankChannel()
    mixerChannels.push(mixerChannel)

    var paramZone=mixerChannel.mInstrumentPluginSlot.mParameterBankZone
    for(var j=0;j<qcCount;j++){

        var count=i*qcCount+j 
        var param=paramZone.makeParameterValue()
        page.makeValueBinding(customAutoVars[count],param)

        if(i<maxAutoChannels){

            knobs[count].mSurfaceValue.mOnProcessValueChange=function(activeDevice,value,diff){

                var channelIndex=Math.floor(count/qcCount)
                var knobIndex=count % qcCount

                if(channelIndex<selectedChannels.length-1){

                    var channel=selectedChannels[channelIndex]
                    var customAutoVarIndex=channel*qcCount+knobIndex
                    customAutoVars[customAutoVarIndex].setProcessValue(activeDevice,value)
                
                }
            
            }
            
        }
    
    }

    var customAutoSelect=page.mCustom.makeHostValueVariable("customAutoSelect"+i)
    page.makeValueBinding(autoChannelSelectors[i].mSurfaceValue,customAutoSelect).mOnValueChange=function(activedevice,activeMapping,value){

        if(value==1){

            var currentChannel=this.i 
            var indexInSelectedChannels=selectedChannels.indexOf(currentChannel)
            if(indexInSelectedChannels>-1){

                selectedChannels.splice(indexInSelectedChannels,1)
            } else {

                if(selectedChannels.length==maxAutoChannels){

                    selectedChannels.splice(0,1)
                }

                selectedChannels.push(currentChannel)
            
            }

        }
        
    }.bind({i})

}