No internet connection
  1. Home
  2. Support

5.8 Problem with trackDelete();

By Jack Green @Jack_Green
    2024-07-17 13:08:16.480Z

    So ive seen this in two scripts so far since I updated to 5.8

     sf.ui.proTools.trackDelete();
    

    seems to be not working?

    So ive tried this

    selectAllTracksStartingWith("F N-")
    
    sf.ui.proTools.menuClick({
        menuPath: ["Track", "Delete"],
    });
    
    try {
        sf.ui.proTools.confirmationDialog.elementWaitFor();
        sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is("Keep").first.elementClick();
        sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: "Disappear" });
    }
    catch (err) {
        sf.keyboard.press({ keys: 'enter', });
    }
    
    sf.ui.proTools.invalidate
    trackNames = sf.ui.proTools.trackNames;
    
    sf.ui.proTools.waitForNoModals();
    
    

    which also doesn't seem to be working (the above code is part of a larger script with this part handling deleting some temporary folder tracks)

    I noticed the delete option in the menu does seem to change between Delete and Delete... I've tried using an if statement to check which menu item is present and clicking that one but it always returned Delete in my case and didn't work.

    Ive also tried putting it in a while loop looking for certain tracks to exist but it just continually goes through the loop selecting the tracks.

    In all of the above I get no errors in the log that it cant click the menu item just nothing happens

    I must be doing something hyper stupid right?

    Thanks in advance!

    Jack

    • 9 replies
    1. Jack Green @Jack_Green
        2024-07-17 15:09:24.748Z

        Got a friend to test the above code and it isn't working for him on 7.8 either...

        It weird as that part of the script has been working flawlessly for months.

        1. In reply toJack_Green:
          Chad Wahlbrink @Chad2024-07-17 16:06:14.441Z

          Hey @Jack_Green!

          sf.ui.proTools.trackDelete(); appears to function normally on SF 5.8.0 on my machine.

          Running the other code you shared doesn't work for me because the function selectAllTracksStartingWith() and the variable trackNames are not defined in that code snippet.

          The best way to help with this kind of issue would be to create a single script with just:

          sf.ui.proTools.trackDelete();
          

          Then click the red "Need Help" button and select "Get help with this script"

          That way, we can access more of your system information, logs, etc., and help you troubleshoot from there.

          Best,
          Chad

          1. Jack Green @Jack_Green
              2024-07-18 12:10:48.325Z

              Thanks for replying.

              Sorry I Only posted part of the snippet I had exported into a new script doing as you described above just getting that part working.

              I think ive managed to get it working today by using

              sf.keyboard.press({ keys: 'left' });
              

              to "reset" the menus after the track select.

              Full code..

              function selectAllTracksStartingWith(startString) {
              
                  var trackNames = sf.ui.proTools.trackNames;
              
                  var startsWith = trackNames.filter(name => name.startsWith(startString));
              
                  sf.ui.proTools.trackSelectByName({ names: startsWith });
              }
              
              sf.ui.proTools.appActivateMainWindow();
              var trackNames = sf.ui.proTools.trackNames
              
              selectAllTracksStartingWith("F N-")
              
              sf.keyboard.press({ keys: 'left' });
              
              sf.ui.proTools.menuClick({
                  menuPath: ["Track", "Delete"],
              });
              
              try {
                  sf.ui.proTools.confirmationDialog.elementWaitFor();
                  sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is("Keep").first.elementClick();
                  sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: "Disappear" });
              }
              catch (err) {
                  sf.keyboard.press({ keys: 'enter', });
              }
              
              sf.ui.proTools.invalidate
              trackNames = sf.ui.proTools.trackNames;
              
              sf.ui.proTools.waitForNoModals();
              

              Thanks again for your help

              Jack

              1. Chad Wahlbrink @Chad2024-07-18 15:40:17.082Z

                Thanks for this, Jack!

                One small note on the above script. In line 30, sf.ui.proTools.invalidate will not run an invalidate method because it is missing the (). This line must be sf.ui.proTools.invalidate() to perform an invalidate action.

            • M
              In reply toJack_Green:
              Matt Friedman @Matt_Friedman
                2024-07-17 19:20:38.311Z

                I noticed the delete option in the menu does seem to change between Delete and Delete... I've tried using an if statement to check which menu item is present and clicking that one but it always returned Delete in my case and didn't work.

                Just FYI:
                If any tracks have data on them (audio) you'll see Delete...
                If all selected tracks are empty you'll see Delete
                The ... indicates there will be dialogs to come, such as the dialog that there is audio on the tracks you're about to delete.

                1. In reply toJack_Green:
                  Chad Wahlbrink @Chad2024-07-18 15:23:33.038Z2024-07-18 15:42:50.414Z

                  Thanks for providing the full script in this post, @Jack_Green!

                  I can reproduce the issue you see in SF 5.8.0 by using sf.ui.proTools. trackSelectByName() and then trying to perform actions from the Track Menu, like Track > Delete.

                  In 5.7.8, using sf.ui.proTools. trackSelectByName() will select the track(s), and the Track menu will update accordingly to allow the tracks to be deleted, etc. In 5.8.0, the Track menu is not updated after track selection, meaning no actions can be taken from the Track menu on the selected tracks. Invalidating also does not work in this instance, but you are correct that a sf.keyboard.press({ keys: 'left' }); seems to jog the UI to update correctly.

                  Thanks for pointing this out, Jack! In the future, I suggest using the Macro/Script Help workflow for this kind of issue so that we can access the logs and the full script in question. Regardless, this is helpful to know!

                  Also, noting this is likely the same issue noted here: Trackselectbyname causes Edit Menu to grey out

                  1. S
                    In reply toJack_Green:
                    SoundFlow Bot @soundflowbot
                      2024-07-18 15:24:47.324Z

                      This issue is now tracked internally by SoundFlow as SF-1368

                      1. S
                        In reply toJack_Green:
                        SoundFlow Bot @soundflowbot
                          2024-12-10 23:51:29.357Z

                          Linked issue SF-1368 updated: This should be fixed in the next release of SoundFlow.

                          1. S
                            In reply toJack_Green:
                            SoundFlow Bot @soundflowbot
                              2024-12-10 23:51:34.191Z

                              The linked internal issue SF-1368 has been marked as Done