rename object name to filename

hi,

can any body help me out to get this easy task..

select $sphere01

with this script line,, i am able to select with script,, but i want extend this script by making the selected file object with script, to make the selection name to be same as file name. if my file name is testing.max,, i want this sphere01 object in max file to be renamed by testing

can anybody help me... thanking you..

kutty

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

Hi Kutty, maxFileName is

Hi Kutty,
maxFileName is what you looking for (#step_1):
$.name = maxFileName -- but if the scene not saved (Untitled) maxFileName return empty string. So, if the scene file name is "test.max", your selected object will be with the same name. But if you want only the name of the scene (without ".max") - #step_2:
$.name = trimRight $.name ".max" -- now your object name is "test"
Or combine code in 1 step only:
$.name = trimRight maxFileName ".max"

my recent MAXScripts RSS (archive here)

fajar's picture

just using Track script ,

just using Track script , you can find it here, it's cool and have ability to select object with given name too !! you'll gonna love it!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.