No internet connection
  1. Home
  2. How to

Copy/Paste Automation To Selection of Tracks

By Blake Bunzel @Blake_Bunzel
    2022-01-12 01:14:01.544Z

    Hello,

    I'm trying to use this script from @Chris_Shaw that works amazingly for doing quick Volume adjustments on selected tracks but to try and use it for Copy/Paste All Automation.

    Essentially the workflow would be to have a selection of tracks where the top most selected track will have automation of any sorts and it would copy the automation from that track (in a selected range) then apply it to the rest of the tracks that were selected when the script is fired.

    Any ideas on how best to do this?

    const VOLUME = '-15';
    sf.ui.proTools.appActivateMainWindow();
    const checkBoxes = [
        { Title: 'I/O', State: "Enable" },
    
    ];
    function setCheckboxState(item) {
        sf.ui.proTools.menuClick({
            menuPath: ['View', 'Edit Window Views', item.Title],
            targetValue: item.State,
            onError: "Continue",
        })
    }
    function setupScreen() {
        //Make sure I/O visible in Edit window
        checkBoxes.forEach(setCheckboxState);
    }
    
    function setVolume() {
        sf.ui.proTools.mainWindow.invalidate();
        if (sf.ui.proTools.selectedTrack.outputWindowButton.value.invalidate().value != 'open')
            sf.ui.proTools.selectedTrack.outputWindowButton.elementClick();
    
        var win = sf.ui.proTools.floatingWindows.allItems.filter(function (w) {
            return w.children.whoseTitle.is('Volume').exists;
        })[0];
    
        win.textFields.whoseTitle.is('Volume Numerical').first.elementClick();
        sf.keyboard.type({ text: VOLUME });
        sf.keyboard.press({ keys: 'enter' });
    }
    
    function main() {
        setupScreen();
    
        TARGET_TRACKS.forEach(function (track) {
            sf.ui.proTools.trackSelectByName({ names: [track] });
    
            //Set the volume
            setVolume();
        });
    
        //Select original track(s) again
        sf.ui.proTools.trackSelectByName({ names: TARGET_TRACKS });
    }
    
    main();
    
    sf.ui.proTools.mainTrackOutputWindow.getElement("AXCloseButton").elementClick();
    
    
    • 3 replies
    1. @Blake_Bunzel give this a shot!

      function copyAllAutomationFromFirstSelectedTrackToRest() {
          function copyAllAutomation() {
              sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Copy Special', 'All Automation'] });
          }
      
          function paste() {
              sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Paste'] });
          }
      
          function pressOkOnAnyConfirmationDialog() {
              const confirmationDialogOkBtn = sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is("OK").first;
      
              sf.wait({ intervalMs: 50 }); // Helps avoid mishaps
      
              sf.ui.proTools.invalidate();
      
              if (confirmationDialogOkBtn.exists) {
                  confirmationDialogOkBtn.elementClick();
                  confirmationDialogOkBtn.elementWaitFor({ waitType: "Disappear" });
              }
          }
      
          function main() {
              sf.ui.proTools.appActivateMainWindow();
              sf.ui.proTools.mainWindow.invalidate();
      
              const selectedTrackNames = sf.ui.proTools.selectedTrackNames;
      
              selectedTrackNames.forEach((track, i) => {
                  sf.ui.proTools.trackSelectByName({ names: [track] });
      
                  if (!i) {
                      copyAllAutomation();
                      return;
                  }
      
                  paste();
      
                  pressOkOnAnyConfirmationDialog();
              });
          }
      
          main();
      }
      
      copyAllAutomationFromFirstSelectedTrackToRest();
      
      1. BBlake Bunzel @Blake_Bunzel
          2022-01-12 18:15:54.822Z

          This works phenomenally!!!! Thank you so much @raphaelsepulveda !!

          1. Oh man I knew somebody would already have built this! Just changed it to PAN Automation only for my needs. GAME CHANGER!