Simple but head-aching connect() issue, urgent!
Sorry for troubling you with such simple questions, but I spend hours
on the problem and I couldn’t find any answers on the mailing-list or
I create a gate object in js, like this:
var theGate = this.patcher.newdefault(100 , 100, "gate");
Now, I want to connect it to an dac~ obect i created in Max and named
(via. name…) "theDac", and I guess Im supposed to do like this:
this.patcher.connect(theGate, 0, theDac, 0);
what you set in Max-land is the "varname" property, and what the
object, very different.
you need this code (or something similar) to get the js max object
associated with the varname "theDac":
var jsDac = this.patcher.getnamed("theDac");
this.patcher.connect(theGate, 0, jsDac, 0);
Thank you Evan
I tried getnamed() like you propose, but then Max crashes when I
If I ask for the content of jsDac by post(jsDac) I get the reply
If you post an example patch and JS file it will be much easier to help.
Is your "theDac" in the same patcher level as the js object? It should work
then. Maybe try a different name? If you don’t want max to crash do
something like this:
post("can’t find dac!n)"
Deleting or connecting objects that don’t exist leads to crashes in js, so
you have to always check for yourself. I’d like to see this get changed to a
friendly error message one day..:-). thispatcher scripts don’t crash on
If you want help with your old patch explain what’s bugging you or send the
patch and I’ll have a look. Otherwise good luck.