- Script Code -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_SILVER")
allCount = reaper.AZ_GetMediaTypeCount(0,"")
--Mute Media Delete
for i = allCount-1,0,-1 do
mute = reaper.AZ_GetMediaMute(0,i)
if mute then
reaper.AZ_DeleteMedia(0,i)
end
end
depthList = reaper.AZ_GetTrackDepthList(0)
count = reaper.AZ_GetTrackCountSelect(0,0)
track,trackId = reaper.AZ_GetSelectedTrackFirstInfo(0)
for a = 0,1 do
for i = count-1,trackId,-1 do
allCount = reaper.AZ_GetTrackMediaTypeCount(0,i,"")
trackList,trackCount = reaper.AZ_GetTrackIdChildList(0,i)
if allCount == 0 and trackCount == 0 then
retval = reaper.AZ_DeleteTrackIdSelect(0,i,0)
end
end
count = reaper.AZ_GetTrackCountSelect(0,0)
for i = 0,count-1 do
track = reaper.AZ_GetTrackItemSelect(0,i,0)
for e, value in pairs(depthList) do
if track == depthList[e].Track then
retval = reaper.AZ_SetTrackItemDepth(track,depthList[e].Depth)
end
end
end
end
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 -
Select the parent track you want to change
- Script Detail -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_SILVER")
・Enable the SILVER API
allCount = reaper.AZ_GetMediaTypeCount(0,"")
・Output the number of media in the project and assign it to allCount
--Mute Media Delete
for i = allCount-1,0,-1 do
・For loop from allCount down to 0
mute = reaper.AZ_GetMediaMute(0,i)
・Detect the mute state of each media
if mute then
・If it was muted
reaper.AZ_DeleteMedia(0,i)
・Handle media deletion
end
end
depthList = reaper.AZ_GetTrackDepthList(0)
・Get the hierarchy of all tracks and assign it to the depthList array
count = reaper.AZ_GetTrackCountSelect(0,0)
・Get the total track count and assign it to count
track,trackId = reaper.AZ_GetSelectedTrackFirstInfo(0)
・Get the first of the selected tracks and assign it to track and trackId
for a = 0,1 do
・Loop the following process twice
for i = count-1,trackId,-1 do
・Loop down toward 0 over the number of tracks
allCount = reaper.AZ_GetTrackMediaTypeCount(0,i,"")
・Get the number of media in the track and assign it to allCount
trackList,trackCount = reaper.AZ_GetTrackIdChildList(0,i)
・Assign the track's child tracks to trackList; assign the number of child tracks to trackCount
if allCount == 0 and trackCount == 0 then
・If there is neither media nor child tracks
reaper.AZ_DeleteTrackIdSelect(0,i,0)
・Delete the track
end
end
count = reaper.AZ_GetTrackCountSelect(0,0)
・After deleting the track, get the track count again and assign it to count
for i = 0,count-1 do
・For loop over count
track = reaper.AZ_GetTrackItemSelect(0,i,0)
・Get the track item for each ID
for e, value in pairs(depthList) do
・For loop over the hierarchy list
if track == depthList[e].Track then
・Detect the tracks in the hierarchy and the track of each ID
reaper.AZ_SetTrackItemDepth(track,depthList[e].Depth)
・Set the hierarchy of the specified track
end
end
end
end
count = reaper.AZ_GetTrackCountSelect(0,1)
・Output the number of tracks and assign it to count
for i = 0,count-1 do
・For loop over count
masterName = reaper.AZ_GetSelectedTrackIdName(0,i)
・Get the name of the selected track
color = reaper.AZ_GetRandomColor()
・Get a random color value
reaper.AZ_SetSelectedTrackIdColor(0,i,color)
・Set the color on the selected track
trackList = reaper.AZ_GetSelectedTrackIdChildList(0,i)
・Get the child array of the selected track and assign it to trackList
for e, value in pairs(trackList) do
・For loop over trackList
reaper.AZ_SetTrackItemColor(trackList[e],color)
・Set the color on the child track item
num = reaper.AZ_FormatNumDigit(e,2)
・Output the sequence number as a zero-padded string 01/02/03/04
setName = masterName.."_"..num
・Append a sequence number to the selected track's name and assign it to setName
reaper.AZ_SetTrackItemName(trackList[e],setName)
・Set a name on each child track
end
end
- API LINK -
- API LINK -
Track
AZSTOKE_AllTrackOrganize
Delete/naming/coloring selected tracks at the beginning











