No internet connection
  1. Home
  2. How to

Error when using <ALL> group dot to select all tracks / open all folders

By Forrester Savell @Forrester_Savell
    2024-09-23 07:32:36.839Z

    I'm using this code (within a larger script) to select all tracks in a session and open all folders.

       try {
            sf.ui.proTools.invalidate()
            sf.ui.proTools.mainWindow.tables.whoseTitle.is("Group List").first.childrenByRole("AXRow").first.childrenByRole('AXCell').first.buttons.first.elementClick();
            log('All folders opened.');
        } catch (error) {
            log(`Error opening all folders: ${error}`);
            throw error; // Abort the script
        }
    

    Sometimes, more than I'd like, it throws the error below. Is this a bug, or is there another method to approach this?

    Error opening all folders: Error: ClickButtonAction
    Error invoking AXElement: kAXErrorCannotComplete (test6: Line 227)
    SoundFlow.Shortcuts.AXUIElementException: kAXErrorCannotComplete
    at SoundFlow.Shortcuts.AXUIElement.DoAction(String action) + 0x98
    at SoundFlow.Shortcuts.Automation.Actions.ClickButtonAction.d__11.MoveNext() + 0x7c

    Solved in post #2, click to view
    • 1 replies
    1. Hey @Forrester_Savell, sometimes interacting with the group elements fails if the Tracks/Groups pane is too narrow. Next time you get the error try making the pane wider and see if that does anything.

      If not, here's a short script that does the same thing:

      const tracks = sf.app.proTools.tracks.invalidate().allItems;
      
      const trackNames = tracks.map(track => track.name);
      
      const folderTrackNames = tracks
          .filter(track => ["BasicFolder", "RoutingFolder"].includes(track.type))
          .map(track => track.name);
      
      
      // Open all Folder tracks
      sf.app.proTools.setTrackOpenState({
          trackNames: folderTrackNames,
          enabled: true
      });
      
      // Select all tracks in session
      sf.app.proTools.selectTracksByName({
          trackNames
      });
      
      Reply1 LikeSolution