No internet connection
  1. Home
  2. Script Sharing

Convert 2 Mono tracks to Stereo track with Auto Renaming and Delete function

By Mike Avenaim @Mike_Avenaim
    2021-06-08 20:19:42.206Z

    Hey all...

    Here is a script i built with @Kitch that allows you to convert 2 mono tracks to stereo and automatically rename the new stereo track and delete the original mono tracks. For e.g. If you someone sends you something to mix from another daw and ProTools makes the overhead tracks split and named "OH.A1 and OH.A2" this script will make those 2 tracks into a new stereo track, rename it to "OH" by removing the suffix and deleting the original mono tracks you no longer need!

    
    /**
     * @param {string} dialogText
     * @param {string} buttonName
     */
    function dismissDialog(dialogText, buttonName) {
        const dlg = sf.ui.proTools.confirmationDialog;
        //Wait 100ms for dialog box to appear
        dlg.elementWaitFor({
            timeout: 100,
            pollingInterval: 10,
            onError: 'Continue'
        });
    
        if (dlg.children.whoseRole.is("AXStaticText").whoseValue.contains(dialogText).first.exists) {
            dlg.buttons.whoseTitle.is(buttonName).first.elementClick();
    
            dlg.elementWaitFor({
                waitType: 'Disappear',
                timeout: 100,
                pollingInterval: 10,
                onError: 'Continue'
            });
        }
    }
    
    function deleteTracks() {
        sf.ui.proTools.trackDelete();
    
        sf.ui.proTools.confirmationDialog.elementWaitFor();
    
        sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is("Delete").first.elementClick();
    
        sf.ui.proTools.confirmationDialog.elementWaitFor({
            waitType: "Disappear",
        });
    }
    
    function main() {
        sf.ui.proTools.mainWindow.invalidate();
    
        //Get Original Track Names
        const originalTrackNames = sf.ui.proTools.selectedTrackNames;
    
        const combinedTrackName = sf.ui.proTools.trackGetByName({ name: originalTrackNames[0] }).track.normalizedTrackName.replace(/.A1|_A1/, '');
    
        const isTrackNameTaken = sf.ui.proTools.trackGetByName({ name: originalTrackNames[0] }).track.normalizedTrackName.match(/.A1|_A1/) === null;
    
        sf.ui.proTools.menuClick({
            menuPath: ["Edit", "Copy"],
        });
    
        sf.ui.proTools.menuClick({
            menuPath: ["Track", "New..."],
        });
    
        const newTrackWin =sf.ui.proTools.windows.whoseTitle.is("New Tracks").first;
    
        newTrackWin.popupButtons.first.popupMenuSelect({
            menuPath: ["Stereo"],
        });
    
        newTrackWin.buttons.whoseTitle.is("Create").first.elementClick();
    
        newTrackWin.elementWaitFor({
            waitType: "Disappear",
        });
    
        sf.ui.proTools.menuClick({
            menuPath: ["Edit", "Paste"],
        });
    
        sf.ui.proTools.mainWindow.invalidate();
    
        if (isTrackNameTaken) {
            sf.ui.proTools.selectedTrack.trackRename({
                newName: originalTrackNames[0] + '_ST',
            });
        } else {
            sf.ui.proTools.selectedTrack.trackRename({
                newName: combinedTrackName
            });
        }
    
        //Reselect Original Track Names
        sf.ui.proTools.trackSelectByName({ names: originalTrackNames });
    
        deleteTracks();
    }
    
    
    main();
    
    
    
    • 2 replies
    1. P
      Philip weinrobe @Philip_weinrobe
        2021-09-14 16:59:14.874Z

        i can't seem to get this to launch at all...

        1. N
          In reply toMike_Avenaim:
          Nelson Canoa @Nelson_Canoa
            2022-03-16 15:14:08.921Z

            Helo KITCH, this is a perfect script for importing the Cubase Nuendo files to Mix im a new user and it seams i cant make it work till the end can you help me?