Two or more osc address on a toggle button

Good morning!
Is it possible to send two osc command from a toggle button?
Like:
/exec/2/1
/exec/3/1

osc

As you see in the screenshot, it works with one of two comands but not with both. Maybe miss a “,” or “;” or something else?

A widget can’t have multiple addresses. To achieve this you need to either use a script widget or a custom module.

Thanks! I never used custom module.
Where I can associate it to a toggle button?
Can you send me an example?

Solution 1: script widget

  • create a script widget
  • set its value property to @{toggle_id}
  • set its target property (if not using the server’s send option)
  • set its script property as follows:
JS{{

send(false, "/exec/2/1", value)
send(false, "/exec/3/1", value)

}}

The script will be executed when the toggle’s value changes;
Referece : https://openstagecontrol.ammd.net/docs/widgets-reference/#script


Solution 2: custom module

This solution works differently, the custom module filters outgoing and incoming osc message, there is no actual “binding” with the widgets but one can use conditions and functions to achieve pretty much anything. Here is a minimal custom module file that routes messages with address /toggle_1 to addresses /exec/2/1 and /exec/3/1.

module.exports = {

  oscOutFilter: function(data) {

    var {address, args, host, port} = data

    if (address == '/toggle_1') {

      // intercept messages from toggle_1 and send some messages

      send(host, port, '/exec/2/1', ...args)
      send(host, port, '/exec/3/1', ...args)

      return // bypass original osc message
    }

    return data

  }

}

You need to set at least one target for the widget or a global default target (server’s send option) to ensure it actually sends a message and gets filtered.

Reference: https://openstagecontrol.ammd.net/docs/custom-module/