- Script Code -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_SILVER")
count = reaper.AZ_GetTrackCountSelect(0,1)
for i = 0,count-1 do
masterName = reaper.AZ_GetSelectedTrackIdName(0,i)
color = reaper.AZ_GetRandomColor()
reaper.AZ_SetSelectedTrackIdColor(0,i,color)
trackList = reaper.AZ_GetSelectedTrackIdChildList(0,i)
for e, value in pairs(trackList) do
reaper.AZ_SetTrackItemColor(trackList[e],color)
num = reaper.AZ_FormatNumDigit(e,2)
setName = masterName.."_"..num
reaper.AZ_SetTrackItemName(trackList[e],setName)
end
end
- Warm Up -
Generate parent-child tracks
Set the name of the parent track
Select Parent Track
- Script Detail -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_SILVER")
Preparation for making SILVERAPI available
count = reaper.AZ_GetTrackCountSelect(0,1)
Get the number of tracks in the open project and assign it to the count variable.
for i = 0,count-1 do
Loop for count times
masterName = reaper.AZ_GetSelectedTrackIdName(0,i)
Get the name of the selected parent track
color = reaper.AZ_GetRandomColor()
Assign a random color value to the color variable
reaper.AZ_SetSelectedTrackIdColor(0,i,color)
Set a color for each parent track
trackList = reaper.AZ_GetSelectedTrackIdChildList(0,i)
- Output the child tracks of each parent into an array and assign them to the trackList array
for e, value in pairs(trackList) do
Loop for the number of trackLists
reaper.AZ_SetTrackItemColor(trackList[e],color)
Parent track color is reflected in child tracks
num = reaper.AZ_FormatNumDigit(e,2)
Outputs two-digit numbers in the order of child track IDs. Example: 01/02/03/04
setName = masterName.."_"..num
Concatenate the parent track name and a two-digit number with _ and assign it to setName
reaper.AZ_SetTrackItemName(trackList[e],setName)
Name each child track
end
end