Changing label in matrix button

You’re mixing up the object notation (key: value) and the javascript syntax ("target": "midi:virtual_midi", is not a valid javascript statement), either write

JS{{
var props = {
  "target": "midi:virtual_midi",
  "address": "/control",
  "preArgs": [3, $+24]
}
var labels = ["mute", "solo"]
props.mode = "toggle"
props.label = labels[$]

return props
}}

or

JS{{
var props = {}
var labels = ["mute", "solo"]
props.mode = "toggle"
props.label = labels[$]
props.target = "midi:virtual_midi"
props.address =  "/control"
props.preArgs = [3, $+24]
return props
}}

EDIT: you don’t need to write #{$ + 24} in a JS{{}} block, just $ + 24 (since #{} and JS{{}} are basically the same thing).

1 Like