top of page
- Script Code -

dofile(reaper.AZ_GetLuaInitPath())

require("reaper_AZSTOKE_SILVER")


trackNameList = {"pl0000","pl1000","pl2000","pl3000","pl4000","pl5000"}

trackColorList = {33554304,33521664,25165824,16777471,21004543,20988032}



--Get Master Select Track

masterTrack = reaper.AZ_GetTrackItemSelect(0,0,1)

masterName = reaper.AZ_GetTrackItemName(masterTrack)

masterDepth = reaper.AZ_GetTrackItemDepth(masterTrack)


for i, value in pairs(trackNameList) do

if masterName == trackNameList[i] then

reaper.AZ_SetTrackItemColor(masterTrack,trackColorList[i])

masterColor = trackColorList[i]

end

end


--Get Master Track Children

childList,masterChildCount = reaper.AZ_GetTrackItemChildList(masterTrack)


childInfoList = {}

for i, value in pairs(childList) do

childInfoList[i] = {}

childInfoList[i]["TrackName"]= reaper.AZ_GetTrackItemName(value)

reaper.AZ_SetTrackItemColor(value, masterColor)

end


--delet trackNameList & trackBaseList create

trCount = reaper.AZ_GetTrackCountSelect(0,0)

deleteIDList = {}

idCount = 0


for i = 0, trCount-1 do

name = reaper.AZ_GetTrackIdName(0,i)

for i, value in pairs(trackNameList) do

if name == value then

idCount = idCount + 1

deleteIDList[idCount] = i

end

end

end


table.sort(deletIDList,function(a,b) return (a>b)end)


for i = 1,idCount do

table.remove(trackNameList,deletIDList[i])

table.remove(trackColorList,deletIDList[i])

end


--Insert Track

for i, value in pairs(trackNameList) do

count = reaper.AZ_GetTrackCountSelect(0,0)

track = reaper.AZ_InsertTrackId(0,count)

reaper.AZ_SetTrackItemName(track,value)

reaper.AZ_SetTrackItemDepth(track, masterDepth)

reaper.AZ_SetTrackItemColor(track,trackColorList[i])

for e = 1,masterChildCount do

childTrack = reaper.AZ_InsertChildTrack(track)

reaper.AZ_SetTrackItemName(childTrack,childInfoList[e].TrackName)

reaper.AZ_SetTrackItemColor(childTrack,trackColorList[i])

end

end




- Warm Up -

Create a base track/child track

- Script Detail -

dofile(reaper.AZ_GetLuaInitPath())require("reaper_AZSTOKE_SILVER")

・Enable API for Silver plan

trackNameList = {"pl0000","pl1000","pl2000","pl3000","pl4000","pl5000"}trackColorList = {33554304,33521664,25165824,16777471,21004543,20988032}

・Set the track base name and each color number and assign it to an array

--Get Master Select Track masterTrack = reaper.AZ_GetTrackItemSelect(0,0,1)

・Get the base track and assign it to the masterTrack

masterName = reaper.AZ_GetTrackItemName(masterTrack)

・Get the name of the track and assign it to masterName

masterDepth = reaper.AZ_GetTrackItemDepth(masterTrack)



・Get the track hierarchy and assign it to masterDepth

for i, value in pairs(trackNameList) do

・Loop for trackNameList

  if masterName == trackNameList[i] then

・If it matches the masterName, do the following:

     reaper.AZ_SetTrackItemColor(masterTrack,trackColorList[i])

・Set the track color

     masterColor = trackColorList[i]

・Set the color to masterColor

  endend

--Get Master Track ChildrenchildList,masterChildCount = reaper.AZ_GetTrackItemChildList(masterTrack)

・Output the child tracks of masterTrack and assign the array to childList

childInfoList = {}

・Prepare an array to register each piece of information for the child track

for i, value in pairs(childList) do

・For loop for childList

   childInfoList[i] = {}

・Prepare an array frame for further information branching of child tracks

   childInfoList[i]["TrackName"]= reaper.AZ_GetTrackItemName(value)

・Assign the track name to childInfoList

   reaper.AZ_SetTrackItemColor(value,masterColor)

・Set masterColor to the same color as child tracks

end

--delet trackNameList & trackBaseList create trCount = reaper.AZ_GetTrackCountSelect(0,0)

・Get the number of tracks

deletIDList = {}idCount = 0

for i = 0,trCount-1 do    name = reaper.AZ_GetTrackIdName(0,i)

・Get name by track ID

   for i, value in pairs(trackNameList) do

・For loop for each trackNameList

       if name == value then

・Search name and trackNameList to see if they match

          idCount = idCount + 1           deletIDList[idCount] = i

・If it matches, it is considered to already exist and the ID is added to the deletion list. 

       end    endend

table.sort(deletIDList,function(a,b) return (a>b)end)
・Sort deletIDList in descending order




for i = 1,idCount do    table.remove(trackNameList,deletIDList[i])    table.remove(trackColorList,deletIDList[i])end



・Erase in order from the back

--InsertTrackfor i, value in pairs(trackNameList) do

・Loop for trackNameList

   count = reaper.AZ_GetTrackCountSelect(0,0)

・Get the number of tracks

   track = reaper.AZ_InsertTrackId(0,count)

・Insert a track at the very end and output the track item

   reaper.AZ_SetTrackItemName(track,value)

・Name the inserted track

   reaper.AZ_SetTrackItemDepth(track,masterDepth)

・Set the inserted track to the same hierarchy as the master

   reaper.AZ_SetTrackItemColor(track,trackColorList[i])

・Set the color according to the trackColorList

   for e = 1,masterChildCount do

・Execute "for" for the number of times equal to masterChildCount

       childTrack = reaper.AZ_InsertChildTrack(track)

・Insert a child track of the inserted track and output the item to childTrack

       reaper.AZ_SetTrackItemName(childTrack,childInfoList[e].TrackName)

・Name Child Tracks

       reaper.AZ_SetTrackItemColor(childTrack,trackColorList[i])

・Set color for child tracks

   endend

require("reaper_AZSTOKE_SILVER")


・Enable API for Silver plan


trackNameList = {"pl0000","pl1000","pl2000","pl3000","pl4000","pl5000"}

trackColorList = {33554304,33521664,25165824,16777471,21004543,20988032}


・Set the track base name and each color number and assign it to an array


--Get Master Select Track 

masterTrack = reaper.AZ_GetTrackItemSelect(0,0,1)


・Get the base track and assign it to the masterTrack


masterName = reaper.AZ_GetTrackItemName(masterTrack)


・Get the name of the track and assign it to masterName


masterDepth = reaper.AZ_GetTrackItemDepth(masterTrack)



・Get the track hierarchy and assign it to masterDepth


for i, value in pairs(trackNameList) do


・Loop for trackNameList


   if masterName == trackNameList[i] then


・If it matches the masterName, do the following:


      reaper.AZ_SetTrackItemColor(masterTrack,trackColorList[i])


・Set the track color


      masterColor = trackColorList[i]


・Set the color to masterColor


   end

end


--Get Master Track Children

childList,masterChildCount = reaper.AZ_GetTrackItemChildList(masterTrack)


・Output the child tracks of masterTrack and assign the array to childList


childInfoList = {}


・Prepare an array to register each piece of information for the child track


for i, value in pairs(childList) do


・For loop for childList


    childInfoList[i] = {}


・Prepare an array frame for further information branching of child tracks


    childInfoList[i]["TrackName"]= reaper.AZ_GetTrackItemName(value)


・Assign the track name to childInfoList


    reaper.AZ_SetTrackItemColor(value,masterColor)


・Set masterColor to the same color as child tracks


end


--delet trackNameList & trackBaseList create 

trCount = reaper.AZ_GetTrackCountSelect(0,0)


・Get the number of tracks


deletIDList = {}

idCount = 0


for i = 0,trCount-1 do

    name = reaper.AZ_GetTrackIdName(0,i)


・Get name by track ID


    for i, value in pairs(trackNameList) do


・For loop for each trackNameList


        if name == value then


・Search name and trackNameList to see if they match

           idCount = idCount + 1

           deletIDList[idCount] = i


・If it matches, it is considered to already exist and the ID is added to the deletion list. 


        end

    end

end


table.sort(deletIDList,function(a,b) return (a>b)end)





for i = 1,idCount do

    table.remove(trackNameList,deletIDList[i])

    table.remove(trackColorList,deletIDList[i])

end



・Erase in order from the back


--InsertTrack

for i, value in pairs(trackNameList) do


・Loop for trackNameList


    count = reaper.AZ_GetTrackCountSelect(0,0)


・Get the number of tracks


    track = reaper.AZ_InsertTrackId(0,count)


・Insert a track at the very end and output the track item


    reaper.AZ_SetTrackItemName(track,value)


・Name the inserted track


    reaper.AZ_SetTrackItemDepth(track,masterDepth)


・Set the inserted track to the same hierarchy as the master


    reaper.AZ_SetTrackItemColor(track,trackColorList[i])


・Set the color according to the trackColorList


    for e = 1,masterChildCount do


・Execute "for" for the number of times equal to masterChildCount


        childTrack = reaper.AZ_InsertChildTrack(track)


・Insert a child track of the inserted track and output the item to childTrack


        reaper.AZ_SetTrackItemName(childTrack,childInfoList[e].TrackName)


・Name Child Tracks


        reaper.AZ_SetTrackItemColor(childTrack,trackColorList[i])


・Set color for child tracks


    end

end

- API LINK -

Track

AZSTOKE_TrackSetSameAutoSetter

Automatically create multiple sets of tracks

01_BRONZE_ss_edited.png
01_SILVER_edited_edited.png
03_GOLD_edited_edited.png
bottom of page