script creating an instance of a patcher, and naming it at the same time

Dan Nigrin's icon

I have an existing patcher, foobar.maxpat. In another patcher, I am trying to create an instance of foobar, and assign a scripting name to it at the same time. I am trying to send the following message to thispatcher:

script newobject foobar @varname foobar_name

...but that doesn't work. I believe the problem is that I need to send the foobar object's box the name, but can't remember how do that?

Dan Nigrin's icon

This works by setting up foobar within a bpatcher, but ideally it doesn't need to be a bpatcher:

script newobject bpatcher @varname foobar_name @name foobar.maxpat

Ideas on how to do this without a bpatcher?

Roman Thilenius's icon

hey,

(with thispatcher-scripting,) after script-creating it, it has a scripting name already. at this point one could send it any kind of message using [send] or via message-to-max?

Dan Nigrin's icon

That's what I don't understand how to do - give it a scripting name?

Roman Thilenius's icon

my max install on the laptop just died, but from what i can recall at this time of the day it should be

script new NAME bpatcher (then position, size and so on.)

no idea why everyone uses @attributes today.

Dan Nigrin's icon

But I don't want a bpatcher - I just want a new instance of my patcher foobar.maxpat.

Roman Thilenius's icon

script newdefault NAME foobar?

Dan Nigrin's icon

Aha!! That's it, thank you!!