Scripting Menu properties in a Matrix


Semi-newbie here. Sorry if this is obvious in the documentation. I've been successful so far at finding answers that are close enough and adapting them to my template, but I've looked around and cant find the answer to this...and my JS skills are minimal, to say the least.

I have a matrix of 7 menus. I would like to know how to set the properties of each menu individually in the matrix:


  • number of items in each menu
  • target, address, preArgs


That would be by writing something like this in the props property:

// example for 3 switches in the matrix
var props = {}

var values = [
  ['a', 'b', 'c'], // 1st switch values
  ['d', 'e', 'f'], // 2nd 
  ['g', 'h', 'i'], // 3rd
var targets = [
  '', // 1st switch target
  '', // 2nd
  '', // 3rd

props.values = values[$] // $ = index of the item in the matrix = targets[$]

return props

Now using a matrix when the items have very different properties implies writing a lot of code and can get overcomplicated where creating 7 switch widgets is sometimes more straightforward,

awesome!! Thank you!