No internet connection
  1. Home
  2. Support

Delete Empty Audio Tracks in Selection is not Working

Delete Empty Audio Tracks in Selection is not Working

System Information

SoundFlow 4.1.1

OS: darwin 18.7.0

ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G1012

Steps to Reproduce

  1. Just Run the comand
  2. Delelte 1 track
  3. Then stop deleting tracks and appears : Could not select track : Audio 3 ( Delete empty audio tracks in selection line 6)
  4. Didn't work any more

Expected Result

Delete all the empty tracks

Actual Result

Crash after the 2 track

Workaround

NO

Other Notes


Links

User UID: h7xUT7YLDvbiQ4zT4HYSpiXqsyk1

Feedback Key: sffeedback:h7xUT7YLDvbiQ4zT4HYSpiXqsyk1:-MHYDMeLecN-UnknoZfl

Feedback ZIP

Solved in post #5, click to view
  • 9 replies
  1. Hi Juan,

    Can you quote the script you're using here?

    1. In reply tochrscheuer:
      JJuan david Chaparro Perez @Juan_david_Chaparro
        2020-09-25 17:01:22.119Z2020-09-25 20:27:12.300Z

        Sure here it is the script

        // Delete Empty Tracks
        
        sf.ui.proTools.appActivateMainWindow();
        
        function processTrack(trackName) {
            sf.ui.proTools.trackSelectByName({ names: [trackName], deselectOthers: true });
            if (sf.ui.proTools.selectedTrackNames[0] !== trackName)
                throw 'Could not select track: ' + trackName;
        
            //Refresh menu
            sf.ui.proTools.selectedTrack.trackScrollToView();
            sf.ui.proTools.selectedTrack.titleButton.mouseClickElement();
        
            var trackIsEmpty = sf.ui.proTools.getMenuItem('Track', 'Delete').exists;
            var trackIsAudioTrack = sf.ui.proTools.selectedTrack.title.value.indexOf('Audio Track') >= 0;
        
            if (trackIsEmpty && trackIsAudioTrack) {
                sf.ui.proTools.getMenuItem('Track', 'Delete').elementClick({}, 'Could not delete track: ' + trackName);
            }
        }
        
        function main() {
            var trackNames = sf.ui.proTools.selectedTrackNames.slice();
            trackNames.map(processTrack);
        }
        
        main();
        
        1. This should work :)

          
          // Delete Empty Tracks
          
          sf.ui.proTools.appActivateMainWindow();
          
          function processTrack(trackName) {
              sf.ui.proTools.trackSelectByName({ names: [trackName], deselectOthers: true });
              if (sf.ui.proTools.selectedTrackNames[0] !== trackName)
                  throw 'Could not select track: ' + trackName;
          
              //Refresh menu
              sf.ui.proTools.selectedTrack.trackScrollToView();
              sf.ui.proTools.selectedTrack.titleButton.mouseClickElement();
          
              var trackIsEmpty = sf.ui.proTools.getMenuItem('Track', 'Delete').exists;
              var trackIsAudioTrack = sf.ui.proTools.selectedTrack.title.value.indexOf('Audio Track') >= 0;
          
              if (trackIsEmpty && trackIsAudioTrack) {
                  sf.ui.proTools.getMenuItem('Track', 'Delete').elementClick({}, 'Could not delete track: ' + trackName);
                  sf.ui.proTools.invalidate();
              }
          }
          
          function main() {
              var trackNames = sf.ui.proTools.selectedTrackNames.slice();
              trackNames.map(processTrack);
          }
          
          main();
          
          ReplySolution
          1. Thanks for helping us solve this issue :)

            1. Didn't work either.

              Actually right now is no Deleting any tracks at all.

              Thanks in advance

              1. The script is designed to only delete any empty tracks that were selected. So make sure to select all tracks you want the script to consider for deletion before running it :)

                1. It worked .

                  Thanks. :)

                  1. Awesome :)

      • M
        Matt Friedman @Matt_Friedman
          2021-04-03 22:18:40.369Z

          I was having a similar sort of issue with this one but I think I fixed it by also adding sf.ui.proTools.invalidate(); to the beginning, just after sf.ui.proTools.appActivateMainWindow();