Widget, scripting field, send() function → get address and target values from the "osc" tab

Shouldn't this also work? (instead of writing the target and the address in the set() function)

Instead, I get this error (when I switch the button on and off):


(solo_push_1/script.script javascript error at line 6: ReferenceError: target is not defined)

The documentation lists the arguments expected by this function. I think what you meant to write is

send('/note', 4, 0, 127)

The "target" argument is indeed optional, but the address is not. However you could also write:

send(getProp('this', 'address'), 4, 0, 127)
1 Like

Sorry, I had a bit of interference from another scripting language I fiddled with in the past 3 months (NI Kontakt KSP). In KSP (Kontakt Script Processor) there's a similar function (with which the user can create any type of MIDI event, as the manual describes it). A conditional statement containing it would look like this:

if $MIDI_CHANNEL=16 // if MIDI message on ch.16 is received by Kontakt
ignore_midi // ignores the message (but stores its properties in the 
// so-called Built-in variables)

// Now, here is the similar function (like the send() function). By
// omitting a parameter, one understands that he/she should use the
// variable name instead. This is what I thought you meant when you said:
// "If omitted, the widget's target will be used." (what I understood: "if 
// omitting to replace "target" with a particular one.").
set_midi($MIDI_CHANNEL, $MIDI_COMMAND, $MIDI_COMMAND_BYTE_1, $MIDI_COMMAND_BYTE_2)
end if