Add prefix or suffix to selected text script?

anyone possibly have a script to do this? thanks in advance

Are you looking to have the user specify the prefix/suffix each time, or is it constant? Separator between the original text and prefix/suffix?

I think Mitch is on it…


Here are a couple of quick hacks… (750 Bytes) (749 Bytes)

1 Like

thanks mitch!

Tried using this when I figured out I can´t read: is it hard to modify this so that I can add prefixes and suffixes to object name. Like selecting objets named X, Y, Z, using the command writing “-51” and getting objects named X-51, Y-51, Z-51 respectively?

It´s strange one would need a script for that. Is there a function that does this? I couldn´t find anything like this.

There are literally hundreds of these types of ‘special requests’ with different variations that are posted here, to have native commands/procedures for them all would be far too much (IMO) when they can easily be custom scripted.

To clarify, you want to select some objects (that have names) and have it add the same suffix to each name? What about objects that are selected that have no name?

For the first part – that´s quite right. I guess not that many people actually need it if I can´t find it anywhere, haha.

For the second part – that´s also quite right. Objects without a name may be singled out using _-Selname “” (empty string) so for the purpouse of this “special request” they may be included, if that´s not a problem. But if that should prove difficult they may be left out.

In any case I thank you for your time :slight_smile:

It’s not difficult either way, simply that an object which has no name will end up with just the prefix or suffix as its name (i.e. 51- or -51), unless you want to automatically name ‘no-name’ objects with something like Unnamed+ prefix or suffix.

I´d just leave the prefix or suffix. Seems like it leaves the most possibilities open to work with souch objects afterwards. Especially if you can _-Selname “-51” nad add your own prefix like “unnamed” afterwards.

OK, here are a couple to try out. (697 Bytes) (697 Bytes)

A perfect couple.

Thank you very much :wink: