No internet connection
  1. Home
  2. How to

Select Tracks by Name

Hi ,
i don't find a script who allow to select one or many tracks by name.
Otherwise thank's for your script about the track folders. Maybe could you improve it with the posibility to choose the track heights of the "slave" tracks?
Thanks for your feedback.
Jean-Pierre

Solved in post #2, click to view
  • 9 replies
  1. Hi Jean-Pierre

    Thank you for your question.

    Selecting either one or many tracks by name can be done in a number of different ways in SoundFlow.

    The easiest way is to:

    • Create a new Macro by clicking "+ New" and choose "Macro". Give it a name.
    • Click "Add Action" and search for "Select Tracks by Name"

    You should now see this action:

    • Now simply enter the names of the Tracks you want to select and hit Enter.

    If you want this as a script, click the "Convert to Script" button:

    ReplySolution
    1. If you just want to select a single track, you can also use the "Select Track" action:

      This action has the added benefit that it has a drop down menu where you can choose the specific track you want to select.

    2. Otherwise thank's for your script about the track folders. Maybe could you improve it with the posibility to choose the track heights of the "slave" tracks?

      This question is not related to the main question of this thread. We generally try to have one specific issue / purpose / script per thread, otherwise it becomes impossible for people to find information and the forum becomes noisy. Please ask this in the appropriate thread or create a new one.

      1. Ok thank's Christian.
        Thank's for "select tracks by name" but it dosen't work with "slave tracks" of track folder.
        Do you have any explanation?
        Thank's in advance.
        Jp

        1. Jean-Pierre, I believe this script should work with tracks inside Folders (what you call "slave tracks") if the tracks are already visible.
          If you toggle folders open & close them a lot, you may have to use a script where you clear the track cache first, to make sure it's updated:

          //Clear track cache
          sf.ui.proTools.mainWindow.invalidate();
          
          //Select track "Audio 3"
          sf.ui.proTools.trackGetByName({ name: "Audio 3", makeVisible: true }).track.trackSelect();
          

          When you're saying it doesn't work, I have the feeling that you're chaining multiple scripts together, since it appears you want to open a Folder track and set the height of the items. Can you try to show us the full script you're using?

          1. Thank’s Christian for your feedback,
            I just only used the macro « Select tracks by name » and I found that it didn't work on the « slaves » visible tracks. I will asap try your script. Thank’s a lot.
            Indeed my goal would be to be able to obtain a scripts who show the « slave » tracks while set up their heights.
            Sorry for my awful english.
            Thank’s again.
            Jp

            1. In reply tochrscheuer:
              JJean-Pierre Laforce @Jean_Pierre_Laforce2
                2020-04-12 18:00:59.912Z2020-04-12 18:03:15.829Z

                It's working with that script:

                /**
                 * @param {AxPtTrackHeader} track Track to toggle
                 */
                function toggleFolderOpen(track) {
                    track.childrenByRole("AXDisclosureTriangle").whoseTitle.contains('Folder').first.elementClick();
                }
                
                toggleFolderOpen(sf.ui.proTools.trackGetByName({ name: 'Folder 1' }).track);
                //Clear track cache
                sf.ui.proTools.mainWindow.invalidate();
                
                sf.ui.proTools.trackSelectByName({
                    names: ["Audio 1","Audio 2"],
                });
                var size = 'medium';
                
                var f = sf.ui.proTools.selectedTrack.frame;
                var popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
                    relativePosition: { x: f.w - 10, y: 5 },    
                }).popupMenu;
                popupMenu.menuClickPopupMenu({
                    menuPath: [size]
                });
                

                The only issue is that just once track is resized!
                I'm searching a solution. If you have it thank's in advance.
                Jp

                1. Hi Jean-Pierre,

                  Thanks for giving us the full context :)

                  This script should do what you want. See the main function for the sequence in which it calls the other functions.

                  
                  /**
                   * @param {AxPtTrackHeader} track Track to toggle
                   */
                  function toggleFolderOpen(track) {
                      track.childrenByRole("AXDisclosureTriangle").whoseTitle.contains('Folder').first.elementClick();
                  
                      //Clear track cache
                      sf.ui.proTools.mainWindow.invalidate();
                  }
                  
                  /**
                   * @param {'small' | 'medium' | 'large'} size
                   */
                  function setHeightOfSelectedTracks(size) {
                      var f = sf.ui.proTools.selectedTrack.frame;
                      var popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
                          relativePosition: { x: f.w - 10, y: 5 },
                          isOption: true,
                          isShift: true,
                      }).popupMenu;
                      popupMenu.menuClickPopupMenu({
                          menuPath: [size],
                      });
                  }
                  
                  
                  function main() {
                      //Toggle folder open
                      toggleFolderOpen(sf.ui.proTools.trackGetByName({ name: 'Folder 1' }).track);
                  
                      //Select tracks
                      sf.ui.proTools.trackSelectByName({
                          names: ["Audio 1", "Audio 2"],
                      });
                  
                      //Set height of selected tracks
                      setHeightOfSelectedTracks('medium');
                  }
                  
                  main();
                  
          2. J

            Hi Christian,
            Thank's a lot it's work perfectly.
            Jp