replace objects

I need someone to confirm. I’d like to find and replace some objects
in my patch as with the Max ‘Edit’ menu, but within my patch. Is
there a javascript function for that or have I to delete an object,
create another one and connect ? I searched thru the js guide and
Max’ tutorials for a replace function, but can’t seem to find
something. I’m still a really beginner with js and rather confused,
so maybe I am missing it ?

Ok. Thank you for answer.
That’s not the answer I was hoping for, though. ;-)

Maybe I’ll try to think about another way to do it. Anyway, I’m not
sure it really worth the effort, since I had a quite useless idea at
the beginning. I was thinking it could be nice for my project for
university to have one patch that could run on both PC and Mac. Then
I was thinking about making an abstraction standing for 3d party
objects (the abst would have the name of the object as argument).
Then on initialization, the patch would replace the abstractions with
appropriate objects placed on a ‘pclib’ or ‘maclib’ folders. But,
well. For now, I only have the js to detect what is the os… I
should probably make the whole patch before thinking about those kind
of problems, hehe.

Of course, I could simply make two versions in separate folders, but
it is much less fun. :-)

Julien Rabin wrote:
> Then I was thinking about making an abstraction standing for 3d
> party objects (the abst would have the name of the object as
> argument). Then on initialization, the patch would replace the
> abstractions with appropriate objects placed on a ‘pclib’ or ‘maclib’
> folders. But, well. For now, I only have the js to detect what is
> the os…

But replace works with normal scripting, it would be possible to replace
one object by another without knowing anything about connections (it
would keep whats connected). Though usually Mac objects and PC objects
which do the same do have the same name and wouldn’t need any replacement…

> I should probably make the whole patch before thinking about those
> kind of problems, hehe.

Quote: Stefan Tiedje wrote on Sun, 05 March 2006 07:04
> But replace works with normal scripting, it would be possible to replace
> one object by another without knowing anything about connections (it
> would keep whats connected).

May I ask you how ? According to the Max Tutorials Manual :

"You can use scripting to replace objects in a patcher and re-establish their previous connections. One important step in doing this is that all objects involved should be named prior to executing the script messages."

It seems that the ‘replace’ message sent to a thispatcher no longer works. Were you refering to an other way to do it ? I’d be glad to hear since I haven’t found another way yet (although I must admit I almost forget what I wanted to do since it was more or less useless, it could be interesting in another context)

The "replace" message to bpatcher no longer works. You want the "script
replace" message to thispatcher. Works like "script new", but replaces
an existing object with the same name (retaining connections as possible).