No internet connection
  1. Home
  2. How to

Copy Track Name Field in Logic Pro?

By Justin Krol @Justin_Krol
    2024-06-09 13:50:33.670Z

    I've been trying to find an economical way to simply copy all selected track names from the name field in Logic Pro X, to paste in either a text edit document or in the Logic notepad.

    I've tried creating a script using key commands, but it's problematic advancing to the next track name to copy and paste. For instance, I CAN:

    copy and paste a track name > open notepad > hit edit > paste name > close note pad > select next track, rinse & repeat all done with just key commands.

    I'd like to find a better way to batch copy the track names in order to paste into the stems after stem printing process is done.

    Any ideas would be super helpful.

    Solved in post #2, click to view
    • 2 replies
    1. Kitch Membery @Kitch2024-06-10 20:29:18.288Z

      This script will get the selected track names in Logic and create a text file on your desktop named "Selected_Track_Names.txt" with the selected track names in it.

      const textFilePath = "~/Desktop/Selected_Track_Names.txt";
      
      function getSelectedTrackNames() {
          const logic = sf.ui.logic;
      
          const trackArea = logic.mainWindow
              .groups.whoseDescription.is('Tracks').first
              .groups.whoseDescription.is('Tracks');
      
          const trackHeadersGroup = trackArea.allItems[1]
              .splitGroups.first
              .splitGroups.allItems[1]
              .scrollAreas.first
              .groups.whoseDescription.is('Tracks header').first;
      
          const selectedTrackHeaders = trackHeadersGroup.getElements('AXSelectedChildren');
      
          const selectedTrackNames = selectedTrackHeaders.map(th => th.getString("AXDescription").match(/“(.*)”/)[1])
      
          return selectedTrackNames;
      }
      
      function addToTextFile(lines) {
          sf.file.writeText({
              path: textFilePath,
              text: lines.join("\n")
          });
      }
      
      function main() {
          const selectedTrackNames = getSelectedTrackNames();
      
          addToTextFile(selectedTrackNames);
      }
      
      main();
      
      ReplySolution
      1. J
        In reply toJustin_Krol:
        Justin Krol @Justin_Krol
          2024-06-10 21:23:02.232Z

          OMG, you're a genius! Thanks so much. What a fix!