I would like a bpatcher to script some things inside itself (which works fine) and then when it is done scripting I would like it to embed itself in its parent. Why do these lines of code in a js object inside the bpatcher file not work?
this.patcher.box.message("sendbox", "embed", 1);
for example, if I make a bpatcher and give it some scripting name x, I can send it this message with a thispatcher object and it will embed itself:
"script sendbox x embed 1"
so how do I do the same from within the bpatcher?
In the JS in your bpatcher, you will need to get the parent patcher, then send a scripting message to your named bpatcher "from" there. Something like this should work:
parent.message("script", "sendbox", "myBpatcher", "embed", 1);
I had a problem trying to do exactly this in Windows. It turned out that the problem was the forward slashes that Windows uses in the absolute path passed to the name attribute. What worked for me was changing the forward slashes to backward slashes.
"c:/path/to/patcher.maxpat" becomes "c:pathtopatcher.maxpat"
C74 RSS Feed | © Copyright Cycling '74