problem: connecting to existing objects via scripting
Jan 14 2012 | 5:05 pm
Hello,
I am trying to connect already existing objects to new generated ones via java-script and it fails.
What I was trying to do for that:
1.) give the existing object a scripting name (e.g.: monitorSndPos)
2.) make a maxobj variable for scripting:
var monitorSndPos = this.patcher.getnamed("monitorSndPos");
3.) after generating the new object, connect the existing object to the new one:
this.patcher.connect(monitorSndPos, 0, theencode, 0);
it doesn't work.
BUT:
when I add the following line into the java-script code, then the desired and the new connection is made:
this.patcher.connect(monitorSpeakerPos, 0, monitorSndPos, 0);
(but this is just a nonsense connection between two already existing objects).
when I now delete this new line again, and execute everything, than it works how it is supposed to be.
It seems to me that there is a problem at the beginning with the initializing of the existing objects, but I can't figure it out. This cannot be a long-term solution, especially when you want to use this script in an external to be usable for others. Maybe someone has an idea?
cheers,
matt