No internet connection
  1. Home
  2. How to

How to select all clips after the current selected clip on a specific track

By Andrew Sherman @Andrew_Sherman
    2021-09-10 09:33:48.909Z

    In Pro Tools, I have a clip selected. I'd like to trigger a script that enables me to select all the clips in the same track that come after the current selected clip.

    I'd also like a variation on it where I can select all clips on all tracks, to the right of the current selection.

    Does anyone have any pointers?

    Initial selection:

    Select all to the right:

    Solved in post #2, click to view
    • 6 replies
    1. samuel henriques @samuel_henriques
        2021-09-10 10:27:15.457Z2021-09-13 11:25:25.961Z

        Hey Andrew,

        This should select from next clip, all the way to the end of last clip on track, or last clip of selected tracks.

        If you want to select current start, all the way to the last clip, comment selectFromNextClip();

        Hope this helps.

        
        sf.ui.proTools.appActivateMainWindow();
        
        function selectFromNextClip() {
            const initialEnd = getSelectionEnd();
            while (true) {
                if (initialEnd >= getSelectionEnd()) {
                    selectNextClip();
                } else {
                    break;
                };
            };
        };
        
        const getLength = () => sf.ui.proTools.selectionGet().selectionLength.replace(/[:.+| ]/g, '');
        const getSelectionEnd = () => sf.ui.proTools.selectionGet().selectionEnd.replace(/[:.+| ]/g, '');
        
        const extendSelToNextClip = () => sf.keyboard.press({ keys: "ctrl+shift+tab" });
        const selectNextClip = () => sf.keyboard.press({ keys: "ctrl+tab" });
        
        //  Zoom to all session
        sf.keyboard.press({ keys: "alt+a" });
        
        // Select from next clip to end.
        selectFromNextClip();  // comment this to select from current to end
        
        while (true) {
        
            const currentLenght = getLength();
        
            extendSelToNextClip();
        
            if (currentLenght != getLength()) {
                extendSelToNextClip();
        
            } else {
                //  Zoom to selection
                sf.keyboard.press({ keys: "alt+f" });
                log("No more clips to select.")
                break;
            };
        };
        
        
        
        Reply1 LikeSolution
        1. AAndrew Sherman @Andrew_Sherman
            2021-09-10 10:54:57.666Z

            That's really cool Samuel, thank you! Hope you're well.

            Very clever to get the number of clips selected.

            One thing I noticed is that after running the script, if the initial clip had fades, it doesn't seem to keep the first fade selected.

            Initial selection:

            Selection after running script:

            I'm wondering if using zoom navigation might be of any use in this as a different approach? For example ALT A for zoom to session, ALT F for zoom to selection. And then somehow click or select to the end of the track.

            1. samuel henriques @samuel_henriques
                2021-09-10 11:16:13.714Z

                UPDATED: above with a fix for the faded clip not selecting the fade.

                and added the zoom thing.

                let me know if this is it.

                1. samuel henriques @samuel_henriques
                    2021-09-10 11:33:02.166Z

                    actually, there's still a problem if the clip has a fade at the end.
                    Let me think about it.

                    1. samuel henriques @samuel_henriques
                        2021-09-10 11:51:14.288Z

                        UPDATED above: I think this is it.

                        Let me know how it goes.

                        1. AAndrew Sherman @Andrew_Sherman
                            2021-09-13 08:39:40.191Z

                            That works perfectly, well done Samuel! Hope it's useful to you and anyone else.