Undo_BeginBlock();//Start Undo
Item_Index = 0;
loop(CountSelectedMediaItems(0),
Item = GetSelectedMediaItem(0, Item_Index);
Track = GetMediaItem_Track(Item);//Get Item parent Track
GetSetMediaTrackInfo_String(Track, "P_NAME", #TrackName, 0);//Get Item parent Track Name
ITEM_NUMBER = GetMediaItemInfo_Value(Item, "IP_ITEMNUMBER");//Get item item number within the track
//==Create #Take_NewName==//
sprintf(#ITEM_NUMBER, "%d",ITEM_NUMBER+1);//Num To String(as 1-based count)
strcat(#TrackName,"_");//#TrackName + "_"
strcat(#TrackName,#ITEM_NUMBER);//#TrackName + #ITEM_NUMBER
#Take_NewName = #TrackName;
//==Re-name each Take==//
Take_Index = 0;
loop(CountTakes(Item),
Take = GetTake(Item,Take_index);
GetSetMediaItemTakeInfo_String(Take, "P_NAME", #Take_NewName , 1);//Rename
UpdateItemInProject(Item);
Take_Index+=1;
);
Item_Index+=1;
);
Undo_EndBlock("~Rename Sel Takes(Trackname+ItemNumber)", -1);//End Undo
UpdateArrange();