about batch renaming and creating objects

Yan Da's icon

I have been exploring object "thispatcher" and all the script messages, but still can't find a straight forward way to do batch renaming and creating objects in a sequentially named fashion.Sure it could be done, but not intuitive at all.

I am wondering if there is an easy way to do the following simple scenario:

Select the objects you want, then batch rename them in various fashion, just like the batch renaming functions from applications like Bridge or A Better Finder Rename, in other words you can find and replace object names in a batched way.

If there is no obvious solution, I highly request this super common purpose feature in future release.

seejayjames's icon

If you know you want named objects, I'd name them upon creation rather than afterwards. Easy enough with array notation: make the first object and call it

my_number[1]

then when you duplicate, they'll be auto-named sequentially. So the same can be used when creating objects with [thispatcher], just use [sprintf] to make the object names in the order you want.

[autopattr @autoname 1] will name everything at once, but the names might not be what you want.

As far as selecting objects and renaming, you can do this with Javascript, because it can determine which objects are selected and can do the renaming. Not sure if there's another way. Look into the [js] help file for ideas.

IIRC I think the Max Toolbox (by Nathaniel LeCaude) lets you do this: naming a row or column of objects. Again, it uses js to do the magic. If you don't have the Toolbox you definitely should check it out for all its other goodies too ;)

Yan Da's icon

Actually here the "name" is not referred to "var_name", but the names inside the object. The most often scenario is that I want create a sent object, say [s test1], then I want to duplicate them so that it automatically renamed sequentially to be [s test1], [s test2], ...or I could just duplicate with the same name, and select and batch rename. I can do this when creating them using [thispatcher]. But can't figure out how to rename exsiting one, cause that's the most efficient way when sketching patches. I used toolbox for years, they could also only rename var_name, not what I mentioned above. Could you point me a more specific way to achieve that, or should I start with the javascript renaming function?

seejayjames's icon

Ah, so the name of the object itself, like different send and receive objects. Gotcha. I think only JS can rename existing ones in that way, though am not sure.