No internet connection
  1. Home
  2. Macro and Script Help

SSL UC1 UF8 Track follow.

By jayrandalljr @jayrandalljr
    2022-10-08 20:51:48.874Z2022-10-11 21:01:42.708Z

    Title

    SSL UC1 UF8 Track follow.

    What do you expect to happen when you run the script/macro?

    This script makes the SSL UC1 and UF8 follow track selection.

    It works for well enough in the edit window. Not so much in the mix window.

    The trouble for me is once it starts it runForever.. Is there a way that I can break out of this loop (without quitting SF)?

    I guess I'd like to be able to toggle this function on and off. Maybe a script that says go kill this script.

    Anyway, thanks in advance!

    Are you seeing an error?

    What happens when you run this script?

    Works

    How were you running this script?

    I clicked the "Run Script" or "Run Macro" button in SoundFlow

    How important is this issue to you?

    3

    Details

    {
        "inputExpected": "This script makes the SSL UC1 and UF8 follow track selection.\n\nIt works for well enough in the edit window. Not so much in the mix window. \n\nThe trouble for me is once it starts it runForever.. Is there a way that I can break out of this loop (without quitting SF)?\n\nI guess I'd like to be able to toggle this function on and off. Maybe a script that says go kill this script. \n\nAnyway, thanks in advance!",
        "inputIsError": false,
        "inputWhatHappens": "Works ",
        "inputHowRun": {
            "key": "-MpfwYA4I6GGlXgvp5j1",
            "title": "I clicked the \"Run Script\" or \"Run Macro\" button in SoundFlow"
        },
        "inputImportance": 3,
        "inputTitle": "SSL UC1 UF8 Track follow. "
    }

    Source

    var lastFocusedTrackName;
    
    function main() {
        try {
    
    
            var newName = sf.ui.proTools.selectedTrackNames[0];
            if (newName === lastFocusedTrackName || newName === undefined) return;
    
    
            //This ultimately makes UF8 follow as well as a work around for banking
            sf.ui.proTools.selectedTrack.trackScrollToView();
            sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({
                isControl: true,
                isShift: true,
            });
    
    
    
            lastFocusedTrackName = newName;
    
    
            const pluginName = 'SSL Native Channel Strip 2';
        
    
    
            const group1Visible = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts A-E').isMenuChecked;
            const group2Visible = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts F-J').isMenuChecked;
            const insertButtons = sf.ui.proTools.selectedTrack.invalidate().insertButtons.slice(group1Visible ? 0 : 5, group2Visible ? 10 : 5);
    
            const eqButton = insertButtons.find(b => b.exists && b.value.invalidate().value.includes(pluginName));
            if (eqButton) {
                eqButton.elementClick();
    
            }
    
    
        } catch (err) {
        }
    }
    
    
    
    function runForever(name, action, interval, timeout) {
        var now = (new Date).valueOf();
        if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
    
        globalState[name] = now;
        sf.engine.runInBackground(function () {
            try {
                while (true) {
                    sf.engine.checkForCancellation();
                    globalState[name] = (new Date).valueOf();
    
                    action();
    
                    sf.wait({ intervalMs: interval, executionMode: 'Background' });
                }
            } finally {
                globalState[name] = null;
            }
        });
    }
    
    runForever("OpenPluginFollowTrackSelection", main, 500, 5000);
    

    Links

    User UID: OsPdq0zC2TMbfNctCtZHEoAvz6E3

    Feedback Key: sffeedback:OsPdq0zC2TMbfNctCtZHEoAvz6E3:-NDtMZpD9f2CQ7EVY_Ni

    Feedback ZIP

    • 11 replies
    1. J
      jayrandalljr @jayrandalljr
        2022-10-10 13:23:58.027Z2022-10-11 21:02:05.736Z

        FYI. I found the solution I was looking for in the following thread.
        "How to control/pause/stop a specific runForever script."
        Code now looks like this.

        var lastFocusedTrackName;
        
        globalState.isFollowFocusedTrackPaused = false;
        
        function main() {
            try {
        
                if (globalState.isFollowFocusedTrackPaused) return;
        
        
                var newName = sf.ui.proTools.selectedTrackNames[0];
                if (newName === lastFocusedTrackName || newName === undefined) return;
        
        
                //This ultimately makes UF8 follow as well as a work around for banking
                sf.ui.proTools.selectedTrack.trackScrollToView();
                sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({
                    isControl: true,
                    isShift: true,
                });
        
        
        
                lastFocusedTrackName = newName;
        
        
                const pluginName = 'SSL Native Channel Strip 2';
            
        
        
                const group1Visible = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts A-E').isMenuChecked;
                const group2Visible = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts F-J').isMenuChecked;
                const insertButtons = sf.ui.proTools.selectedTrack.invalidate().insertButtons.slice(group1Visible ? 0 : 5, group2Visible ? 10 : 5);
        
                const eqButton = insertButtons.find(b => b.exists && b.value.invalidate().value.includes(pluginName));
                if (eqButton) {
                    eqButton.elementClick();
        
                }
        
        
            } catch (err) {
            }
        }
        
        
        
        function runForever(name, action, interval, timeout) {
            var now = (new Date).valueOf();
            if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
        
            globalState[name] = now;
            sf.engine.runInBackground(function () {
                try {
                    while (true) {
                        sf.engine.checkForCancellation();
                        globalState[name] = (new Date).valueOf();
        
                        action();
        
                        sf.wait({ intervalMs: interval, executionMode: 'Background' });
                    }
                } finally {
                    globalState[name] = null;
                }
            });
        }
        
        runForever("OpenPluginFollowTrackSelection", main, 500, 5000);
        
        
        I have a separate script that simply does:
        
        globalState.isFollowFocusedTrackPaused = true;
        
        
        1. Jjayrandalljr @jayrandalljr
            2022-10-10 15:11:56.698Z2022-10-11 20:59:29.943Z

            This actually functions better if you can deal with the scroll to track popup that happens briefly. For anyone interested.

            Code found in "Add global state variable to clipboard" thread.

            var lastFocusedTrackName;
            
            globalState.isFollowFocusedTrackPaused = false;
            
            function main() {
                try {
            
                    if (globalState.isFollowFocusedTrackPaused) return;
            
            
                    var newName = sf.ui.proTools.selectedTrackNames[0];
                    if (newName === lastFocusedTrackName || newName === undefined) return;
            
            
                    //This ulitmately makes UF8 follow as well as a work around for banking
            const selectedTrackName = sf.ui.proTools.selectedTrackNames[0];
            
            globalState.selectedTracksJT = selectedTrackName;
            
            //log(globalState.selectedTracksJT);
            
            
            //function scrollToTrack(trackName) {
                sf.ui.proTools.appActivateMainWindow();
            
                var originalClipboardText = sf.clipboard.getText().text || '';
            
                sf.ui.proTools.menuClick({ menuPath: ["Track", "Scroll to Track..."] });
            
                sf.ui.proTools.confirmationDialog.elementWaitFor();
            
                sf.clipboard.setText({ text: selectedTrackName });
            
                sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Paste'] });
            
                sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is("OK").first.elementClick();
            
                sf.clipboard.setText({ text: originalClipboardText, });
            
            
                    lastFocusedTrackName = newName;
            
            
                    const pluginName = 'SSL Native Channel Strip 2';
                
            
            
                    const group1Visible = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts A-E').isMenuChecked;
                    const group2Visible = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts F-J').isMenuChecked;
                    const insertButtons = sf.ui.proTools.selectedTrack.invalidate().insertButtons.slice(group1Visible ? 0 : 5, group2Visible ? 10 : 5);
            
                    const eqButton = insertButtons.find(b => b.exists && b.value.invalidate().value.includes(pluginName));
                    if (eqButton) {
                        eqButton.elementClick();
            
                    }
            
            
                } catch (err) {
                }
            }
            
            
            
            function runForever(name, action, interval, timeout) {
                var now = (new Date).valueOf();
                if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
            
                globalState[name] = now;
                sf.engine.runInBackground(function () {
                    try {
                        while (true) {
                            sf.engine.checkForCancellation();
                            globalState[name] = (new Date).valueOf();
            
                            action();
            
                            sf.wait({ intervalMs: interval, executionMode: 'Background' });
                        }
                    } finally {
                        globalState[name] = null;
                    }
                });
            }
            
            runForever("OpenPluginFollowTrackSelection", main, 500, 5000);
            
            
            1. Hey Jay,
              Glad that you were able to solve you issue.
              In case you haven't seen it, this article demonstrates how to properly quote code on the SF forums.

              //CS//

              1. Jjayrandalljr @jayrandalljr
                  2022-10-11 21:02:57.462Z

                  Thanks you, sir!

                  1. Jjayrandalljr @jayrandalljr
                      2022-10-11 22:42:48.861Z

                      Also this will toggle the script on and off from a separate script.

                      if (globalState.isFollowFocusedTrackPaused) 
                          {
                              globalState.isFollowFocusedTrackPaused = false;
                          }
                          else
                      globalState.isFollowFocusedTrackPaused = true;
                  2. In reply tojayrandalljr:
                    MMarco Lopez @Marco_Lopez7
                      2025-10-06 08:13:00.417Z

                      Thank you Jay for this! I was trying to figure out a way to make the SSL UF8 to follow the selected track on pro tools. Now it works!

                      1. And now you don’t need it at all! SSL just figured it out with 360 v2.0 and it’s brilliant! :)

                        1. MMarco Lopez @Marco_Lopez7
                            2025-10-30 09:32:04.396Z

                            HI Jay! I did upgrade to the SSL 360 v2, but once I am selecting a track in Pro Tools, the UF8 does not follow. Is there any further setting that I need to do and which I am not aware of?

                            1. MMarco Lopez @Marco_Lopez7
                                2025-10-30 11:03:39.897Z

                                I was in contact with the SSL support and they explained that I need to own any of the following SSL pluggin in order to use this feature, otherwise it does not work.

                                4K G
                                4K E
                                4K B
                                Channel Strip 2
                                Bus Compressor 2
                                Meter
                                Meter Pro
                                360 Link
                                360 Link Bus Comp

                                1. This is true, but if you don’t want to use the 360 ecosystem, you can just put the 360 Link plugin (free) without loading anything into it, on each track and work in plugin mixer mode. You’ll get track follow, colours, automation and focus and they’re working to bring more HUI hybrid stuff to blend the two in the future.

                                  1. MMarco Lopez @Marco_Lopez7
                                      2025-10-30 16:28:28.397Z

                                      That sounds great, I’ll do that! Thanks for the suggestion!