-- get the index of the current active material slot mySlot = medit.GetActiveMtlSlot() -- applies the material in slot 1 to variable myMaterial myMaterial = getMeditMaterial mySlot -- counts the number of sub materials in myMaterial applies it to mySubs mySubs = myMaterial.numsubs -- loop through all the sub materials of myMaterial and do for i = 1 to mySubs do ( -- get the diffuse bitmap name myString = myMaterial.materialList[i][#Maps][4].name -- create a blank string to remove "diffuse color" from string with test = "" -- remove "diffuse Color from string" myString = replace myString 1 15 test -- rename sub name with myString myMaterial.names[i] = myString -- rename sub-material with myString myMaterial.materialList[i].name = myString )