load and modify saved patch from a master patch
Hi guys,
I've been trying to find a way to do this for a few days now and keep coming up against brick walls.
As the title suggests what I am trying to do is to open a .maxpat from a 'master' patch and then to get the 'patcher' object of this newly open patch so that I can do things like change it's windows title.
I have managed to open a .maxpat file using this:
'
function openPat (refName, filePath) {
if(refName){
max.closefile(refName);
}
max.openfile(refName, filePath);
}
'
Now. I can't find a way of talking to this patcher from js.
I have tried doing: 'v = refName.patcher;'
I have also tried traversing the patchers 'using wind.next' with no success.
I have also looked into the patcher constructor but you can't specify a filename when creating one.
My main goal is to be able to open .maxpat files and to change their titles to a unique id so that I can load multiple copies of the same file and talk to each of them individually from the master patch.
If anyone could give me any leads that would be great.
Also let me know if I need to explain myself further.
Thanks
Bump
Still having problems with this.
Does anyone know if there is a way of assigning a window created with 'max.openfile(reference, filename);' to a variable?
At the moment I am having to create the new patcher window, then wait for a 'ready' signal from the new patcher window to then cycle through all open windows with wind.next to get the patcher then rename it to the openfile reference. Although this sometimes works it mostly throws up errors or I have to add [delay] objects to make the 'ready' signal wait a bit.
I have attached a max project that highlights my problem.
Please give it a look over if you can, too many days have been wasted on this problem already.