top of page

AZSTOKE/ALGAZODIK

GameAudio & Art

1

Track

AZSTOKE_SelectTrackChildAutoNameAndColor

Automatically increment names and automatically color children of selected tracks

RANK
SNS SHARE

package.cpath = package.cpath .. ";"..reaper.GetResourcePath() .."/UserPlugins/?.dll"

require("reaper_AZSTOKE_SILVER")


function Msg(param)

 reaper.ShowConsoleMsg(tostring((param)).."\n")

end


retval,count = reaper.AZ_GetTrackCountSelect(0,1)


for i = 0,count-1 do

   retval,masterName = reaper.AZ_GetSelectedTrackIdName(0,i)

   retval,color = reaper.AZ_GetRandomColor()


   reaper.AZ_SetSelectedTrackIdColor(0,i,color)

   retval,trackList = AZ_SILVER.AZ_GetSelectedTrackIdChildList(0,i)

   for e, value in pairs(trackList) do

       reaper.AZ_SetTrackItemColor(trackList[e],color)

       retval,num = reaper.AZ_FormatNumDigit(e,2)

       setName = masterName.."_"..num

       reaper.AZ_SetTrackItemName(trackList[e],setName)

   end

end

package.cpath = package.cpath .. "; "..reaper.GetResourcePath() .."/UserPlugins/?.dll"

require("reaper_AZSTOKE_SILVER")


  • Preparation for making SILVERAPI available


function Msg(param)

reaper.ShowConsoleMsg(tostring((param)).."\n")

end


  • Console output functions


retval,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

retval,masterName = reaper.AZ_GetSelectedTrackIdName(0,i)


  • Get the name of the selected parent track


retval,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

retval,trackList = AZ_SILVER.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

retval,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

To use the API, you need to sign up for a plan.

Download the dedicated API

need to do it.

*SILVER is scheduled to be released in May.

  • Generate parent-child tracks

  • Set the name of the parent track

  • Select Parent Track


- Script Code -
- Script Image -
- Warm Up -
- Script Detail -
- API -

LUA

​ReaScript File Download 👇

* A dedicated API is required to run this

- Script Image -
bottom of page