- 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")
・Enabling the SILVER API
allCount = reaper.AZ_GetMediaTypeCount(0,"")
・Output the number of media in the project and assign to [allCount]
--Mute Media Delete
for i = allCount-1,0,-1 do
・For loop from [allCount] to 0
mute = reaper.AZ_GetMediaMute(0,i)
・Detect mute of each media
if mute then
・If mute
reaper.AZ_DeleteMedia(0,i)
・Support for deleting media
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 number of tracks and assign to count
track,trackId = reaper.AZ_GetSelectedTrackFirstInfo(0)
・Get the first track of the selected track 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 toward 0 for 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 child tracks of a track to [trackList]. Assign the number of child tracks to [trackCount].
if allCount == 0 and trackCount == 0 then
・If there is no media and no child track
reaper.AZ_DeleteTrackIdSelect(0,i,0)
・Delete Track
end
end
count = reaper.AZ_GetTrackCountSelect(0,0)
・Get the number of tracks again after deleting tracks Assign to [count]
for i = 0,count-1 do
・For loop for count
track = reaper.AZ_GetTrackItemSelect(0,i,0)
・Retrieve track items for each ID
for e, value in pairs(depthList) do
・For loop for hierarchical list
if track == depthList[e].Track then
・Detects tracks in the hierarchy and tracks for each ID
reaper.AZ_SetTrackItemDepth(track,depthList[e].Depth)
・Set the hierarchy for the specified track
end
end
end
end
count = reaper.AZ_GetTrackCountSelect(0,1)
・Output the number of tracks and assign to [count]
for i = 0,count-1 do
・For loop for 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 color to selected track
trackList = reaper.AZ_GetSelectedTrackIdChildList(0,i)
・Get an array of children of the selected track and assign it to [trackList]
for e, value in pairs(trackList) do
・For loop for the number of [trackList]
reaper.AZ_SetTrackItemColor(trackList[e],color)
・Set color on child track items
num = reaper.AZ_FormatNumDigit(e,2)
・Output string of digits to permutation number 01/02/03/04
setName = masterName.."_"..num
・Assigns a digit number to the name of the selected track and assigns it to [setName]
reaper.AZ_SetTrackItemName(trackList[e],setName)
・Set a name for each child track
end
end