problem: connecting to existing objects via scripting
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.
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?
I’ve never had this problem with patcher scripting. I’d be happy to help you look in to the problem though. If you could try to replicate it with the fewest objects/smallest js code possible and attach the files here I’ll take a look if you’d like.
ok, the problem seems to be in the ambimonitor object from the Ambisonics Externals for Max/MSP. If I try it with standard objects like e.g. sliders, it behaves correctly. I found a third way for me, more a work-around: when I don’t use preexisting ambimonitor objects but let them generate via scripting too, then it works. It’s not really the solution I was looking for, but it is also probably a problem in the Externals, and not in Max.
----------begin_max5_patcher---------- 1028.3oc0YkraaCCD8r8WAgNk.j3HRpE6FzC4d6k1i0EExVLwLwhJPhtMsA4 eubQJlxKxzZqnIHRPbYzadCeyPp753QNKRegj6.9.3afQidc7nQpljMLp34Q NIQurbcTtZXNK1v4oLmqzcw1jPYqIbUevsMltguaqzX07SW730vokyWON9ue lnwfyhH1CNfuWz8yQ7kqnrG9QFYIWOhoAASbuBf8lJugbKuB9tbJuMdr7xUV 5LLxuD3oDLbxKpWhyi4fkoLl3cRSY4WyI47qSRYTdZVNZxi4kS39TFOm9GE1 gHARZEoL6njxVBQ9FYQIpNbtKiFs14zTUn5FLbVq3pNIv617.OJPEw87892D 36s3Nrqi6kL0TjNtiZEUEkrfVvAkuyeFk8NXxnOrh+4p8aAQfKgeFImv3QRB 2vEvgp3KNHb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