No internet connection
  1. Home
  2. How to

Question: Is it possible to deselect a specific track while keeping others selected?

By Eric Huergo @Eric_Huergo
    2023-02-25 04:00:31.590Z

    Heyo everyone, back at it with yet another somewhat niche question.
    I stumbled across the thread Is there a way to deselect a track?
    However, unfortunately nowhere in there (or anywhere else) did I find an answer to this specific scenario.

    If, for instance, someone were to have an array of tracks selected (for example, 'Audio Track 1' through 'Audio Track 20') how could we specifically deselect one track (for example, 'Audio Track 12') so that the remaining 19 tracks would still be selected?

    Is there currently any way to achieve this using SoundFlow?

    • 4 replies
    1. Mitch Willard @Mitch_Willard
        2023-02-26 22:47:17.157Z2023-02-27 12:00:02.884Z

        Hi @Eric_Huergo

        Here you go.

        This will give you a pop up menu to choose which track within the selection you want to deselect from your selection.

        
        function deselectTrackInsideSelection() {
        
            const sup = sf.ui.proTools;
        
            function scrollToTrack(trackName) {
        
                let confirmationDlg = sup.confirmationDialog;
        
                sup.menuClick({
                    menuPath: ["Track", "Scroll to Track..."]
                });
        
                confirmationDlg.elementWaitFor({
                    waitType: "Appear",
                    pollingInterval: 200
                });
        
                confirmationDlg.textFields.first.elementSetTextFieldWithAreaValue({
                    value: trackName,
                });
        
                confirmationDlg.buttons.whoseTitle.is("OK").first.elementClick();
        
            };
        
            sup.appActivateMainWindow();
        
            var originalSelectedTracks = sup.selectedTrackNames;
        
            var trackToDeselect = sf.interaction.popupSearch({
                items: originalSelectedTracks.map(trackName => ({ name: trackName })),
                columns: [
                    { name: 'Choose Track to REMOVE from selection.', key: 'name', width: 100 }
                ],
            }).item.name
        
            scrollToTrack(trackToDeselect);
        
            sup.trackSelectByName({ names: originalSelectedTracks });
        
            sup.trackGetByName({ name: trackToDeselect }).track.titleButton.mouseClickElement({
                isCommand: true,
            });
        
            var newSelectedTracks = sup.selectedTrackNames;
        
            scrollToTrack(originalSelectedTracks[0]);
        
            sup.trackSelectByName({ names: newSelectedTracks });
        
        };
        
        deselectTrackInsideSelection();
        
        
        

        Cheers

        Mitch

        1. Eric Huergo @Eric_Huergo
            2023-02-28 07:04:04.970Z

            Thank you so much @Mitch_Willard !!!

            I think I should definitely be able to adapt this into my script!

            Appreciate you! :)

            1. In reply toMitch_Willard:
              PPhilip weinrobe @Philip_weinrobe
                2023-08-22 12:21:34.831Z

                is there a way to get a simpler version of this process that doesn't involve asking the user to choose which tracks to deselect?
                I have a process where the tracks to deselect never change. i just want to input their names and have them deslected automatically from a previous selection (keeping all other selected tracks selected).

                basically, exactly what this script does, but pre-defining the tracks to deselect.

                thank you!
                philip

                1. Mitch Willard @Mitch_Willard
                    2023-08-23 00:02:14.273Z

                    Hi @Philip_weinrobe

                    There totally is!

                    
                    function removeTrackFromSelection(track) {
                    
                        var verifyTrackList = sf.ui.proTools.selectedTrackNames;
                    
                        let doesTrackExist = (verifyTrackList.filter(n => n === track)[0] === track);
                    
                        if (doesTrackExist) {
                    
                            sf.ui.proTools.trackSelectByName({ names: verifyTrackList.filter(n => n != track) });
                    
                        };
                    };
                    
                    
                    
                    /////Add your track to deselect here
                    removeTrackFromSelection('Your Track Name Goes Here');
                    
                    

                    Cheers

                    Mitch