No internet connection
  1. Home
  2. How to

Rename Track Progressively (Increase Button)

By studio@keasound.com @studiokeasound_com
    2023-01-24 11:53:19.481Z

    Good morning!
    I am looking for help in creating a command that is very useful to me for adr.
    I would like to create a command that renames the track in a progressive manner.
    For example if the track is named RML001, I would like it to automatically rename 002 and every time I push the button it increments by +1 (002 become 003 then 004 etc etc).
    Is there any way?
    I hope someone can help me, thanks :)

    Solved in post #2, click to view
    • 3 replies
    1. Kitch Membery @Kitch2023-01-24 20:05:41.593Z

      This script will increment the selected track number.

      sf.ui.proTools.appActivateMainWindow();
      
      sf.ui.proTools.selectedTrack.trackRename({
          renameFunction: (trackName) => {
              // Find the last sequence of numbers in the trackName
              let match = trackName.match(/\d+$/);
      
              // If there is a match for a number, remove any decimals and increment +1
              // If there is no matching number the new number will be 2
              let num = match ? parseInt(match[0]) + 1 : 2;
      
              // Add leading zeroes for a maximum of 3 digits.
              let numStr = num.toString().padStart(3, "0");
      
              if (match) {
                  // Replace the last sequence of digits with the incremented number
                  return trackName.replace(/\d+$/, numStr);
              } else {
                  // Return trackName(without the original number) + 002
                  return trackName + numStr;
              }
          }
      });
      

      Note: This only renames the track it does not duplicate the playlist.

      I hope that helps.

      Reply1 LikeSolution
      1. Hi Kitch,
        Thank you very much for your help.
        It is working perfectly.
        I just implemented it to make it work with two different tracks.
        Doing adr recordings I often get to work with both 1 and also 2 microphones.
        Thank you very much!

      2. B
        Benjamin Mixer @BenjiMix
          2024-12-10 17:19:56.734Z

          Hi, thank you for the script
          In my case, this script put the number at the end of the text.

          I would like to increment or decrement the second number in my track name. For example, the name of the track is for the first record:

          FLG30018_01_BOOM_DANCE_IN_THE_DARK

          and the next will be:

          FLG30018_02_BOOM_DANCE_IN_THE_DARK
          FLG30018_03_BOOM_DANCE_IN_THE_DARK
          Etc...
          do you know how to do please?