Embed bpatcher from inside

May 9, 2011 at 8:27pm

Embed bpatcher from inside

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?

May 9, 2011 at 10:34pm

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:

function bang()
parent.message(“script”, “sendbox”, “myBpatcher”, “embed”, 1);

Dec 30, 2012 at 6:45am

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”


You must be logged in to reply to this topic.