Auto Pick Script


I need some help:
I need a simple script to rename quickly the picked objects in the scene, in rollout i want a Text Box with the name exemple: “name_01” and a Button to activate the auto name assignment.
When the option is ON i want that for each pick objects the script raname it “name_01”, after if i re-pick an other objects the script re-name “name_02” and so on until the option is ON.
I know a bit maxscript but i don’t know now create a cicled function like this :wink:


Then you should definitely have a look at callbacks.
These allow your script to be called whenever something in the scene changes (depends on what you choose ofcourse). Have a look and post back what you tried!



You could also do this with a mouse tool probably… just active the tool, and then start clicking objects, should be pretty straightforward to have it to the renaming on click.


This is a test, but i don’t know now change the “stop” function “IF i>10” DO EXIT", exemple how can i stop the recursive autorename with right clic ?

macroScript AutoReName category:"MyTool" tooltip:"AutoReName"
local i=0
while true do
	obj = pickObject() = "name_" + i as string
	messageBox ("obj picked: " + -- this is only a test, i'll delete
	if i>10 do exit -- i want a different exit, exemple with a right clic....


I john
look at this example:

while obj!=undefined then
-- do something



If you just want to increment the number at the end of the name, you can just use the “uniqueName” command.

$.name = uniqueName "bob_"

Renames the selected object “bob_001”. If you run it again on another object, it will be named “bob_002”.

And if you’re using Max 2011, there’s a new parameter that controls the number of digits to use:

uniqueName "bob_" numDigits:4

This would give you “bob_0001” instead of “bob_001”.


Very interesting but is only an exemple, the real name is:

		Cpx = formattedPrint CpxCount format:"02i"
		Str = formattedPrint StrCount format:"02i"
		Num = formattedPrint NumCount format:"03i" = "Cpx"+Cpx + "_Str"+ Str + "_Obj" + Num + "_1"


i make a tool that work well but someone can suggest me something better?


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.