No internet connection
  1. Home
  2. How to

bug: trackSelect methods aren't updating clip detection

By Ian Shedd @Ian_Shedd
    2023-01-17 17:59:56.840Z

    Issue: After making a selection in Pro Tools that contains a clip, then using a track selection script method or macro to select a track with no clips, Pro Tools still thinks a clip is selected.

    The macro:

    Expected behavior: When manually selecting a different track as normal (with link timeline + track and edit selection buttons enabled), Pro Tools correctly disables menu functions when no clips are selected.

    Weird behavior: After running the macro, or other variations in scripting such as sf.ui.proTools.trackSelectByName(...), Pro Tools seems to still think that a clip in within the selection.

    Note in both cases, the clip is deselected from the Clip List.

    Changing the selection length, then putting it back seems to correct the issue, so there are work arounds, but still it doesn't seem like intended behavior.

    Cheers!

    • 12 replies
    1. O

      Sometimes the menu's need a kick to refresh... this is one of the hacks to do it I've learned here on the forum

          ///Re-evaluate here... HACK TO REFRESH MENUS
          sf.keyboard.press({ keys: 'n', fast: true, repetitions: 2 });
      

      or another one

      /// Reset Menu
      sf.keyboard.press({
          keys: "left",
          repetitions: 2,
          fast: true,
      });
      

      I believe this is the issue you are finding?

      1. IIan Shedd @Ian_Shedd
          2023-01-17 19:54:10.559Z

          Yes the menu refresh is the issue. I've found similar workarounds, i'll add yours to the arsenal, thanks!

          1. Oh they ain't my tricks, just things I've learned here.

          2. Is there any new SDK related tech to better do this? I'm in a situation where even this doesn't seem to be refreshing the menus.

            1. This may be a shot in the dark but maybe try invalidating the tracks via the SDK:
              sf.app.proTools.tracks.invalidate()

              If that doesn't work try using the SDK to reselect selected tracks:

              const tracks = sf.app.proTools.tracks.invalidate().allItems;
              const selectedTracks = tracks.filter(t => t.isSelected).map(t => t.name);
              sf.app.proTools.selectTracksByName({ trackNames: selectedTracks, selectionMode: "Replace" })
              

              Let me know if either of these work - I don't have any scripts experiencing this issue

              1. i may try this for other things, my current issue is a menu refresh i didn't realize what i was responding too lol, i'm gonna try an alternative work around though.

                also ooooo didn't realize sf.app.proTools.selectTracksByName was implemented. excuse me while i replace code in 5000 scripts :P

                1. I’m thinking that invalidating / reselecting tracks would force a menu refresh

                  1. It only takes about 150ms to re-select a couple dozen tracks with the SDK commands

                    1. I am super stoked about this... definitely going to spend a couple days at some point updating all my packages to use this instead of .ui should fix a lot of inconsistencies and speed to boot.

                      1. I updated one of my session prep scripts that I wrote ages ago before I knew anything and implemented the SDK commands and cut the execution time in half

                        1. The track select command saves a boatload of time.

                    2. In reply toChris_Shaw:

                      True true, I also realized i had the .isEnabled in the totally wrong place in the script, once i moved it worked much smoother. pretty proud of the code over all though Copy region edits to next track - is a script like this possible? #post-29 finally cracking 'count fades and crossfades all as one clip'