script new prototype

stephane moreau's icon

Hi,

I'd like to dynamically populate a patch with subpatches following certain rules and conditions.
The subpatches already exist.

Example :
under condition A, a "script to thispatcher" would create a newobj patcher, being one "modeA"
under condition B, blablabla................... one "modeB"

I dont know beforehand how many A and B need to be created, that's why I thought about the prototype, but don't know how to get access to it with scripting.

I know I could save the patchers modeA modeB in a folder, then recall them with
script newobject newobj @text modeA

It works, I just did it, but I've got like 25 of those "mode" patches, with very little material inside. It would be such a waste

Sure I'm missing something...

Any idea ?

stephane moreau's icon

Well actually I guess snippets, prototypes, templates... are not portable, nor included inside a project...

What I'd need is having the patchers modeA modeB... already in some corner of the main patcher, as a catalog, so I could copy paste them programmatically and then connect them

stephane moreau's icon

Javascript is still quite confusing to me, I'm trying a bit.
If you have any lead for my initial question, dont hesitate !