No internet connection
  1. Home
  2. How to

Switch to mix window and scroll into view

By Oren Hadar @Oren_Hadar
    2021-01-19 23:38:15.283Z

    Hi all,

    I'm trying to write a script that switches to the mix window and scrolls the currently selected track into view. My thinking is to select Window -> Mix and then ctrl-Shift click the currently selected track, but the scrolling part isn't working. What am I doing wrong?

    sf.ui.proTools.menuClick({ menuPath: ['Window', 'Mix'] });
    sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({
                isControl: true,
                isShift: true,
            });
    
    • 2 replies
    1. Hi Oren,

      Unfortunately, SoundFlow's concept selectedTrack for now is only designed to work in the Edit window. We don't have any built-in actions for the Mix window.

      1. In reply toOren_Hadar:

        Hey Oren!

        While SoundFlow doesn't have functionality for the Mix window yet, we can still scroll to the currently selected track using PT's Scroll to Track dialog box, like so:

        
        /**@param {string} trackName */
        function ptScrollToTrack(trackName) {
            sf.ui.proTools.menuClick({ menuPath: ['Track', 'Scroll to Track...'] });
        
            sf.ui.proTools.confirmationDialog.elementWaitFor();
        
            sf.ui.proTools.confirmationDialog.textFields.first.elementSetTextFieldWithAreaValue({
                value: trackName
            });
        
            sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is('OK').first.elementClick();
        
            sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Disappear' });
        };
        
        sf.ui.proTools.appActivateMainWindow();
        sf.ui.proTools.mainWindow.invalidate();
        
        // Get selected track name
        const selectedTrackName = sf.ui.proTools.selectedTrack.normalizedTrackName;
        
        // Switch to Mix Window
        sf.ui.proTools.menuClick({ menuPath: ['Window', 'Mix'] });
        
        // Scroll to Track
        ptScrollToTrack(selectedTrackName);
        

        Hope that helps!