No internet connection
  1. Home
  2. How to

Requesting help for a script: Copy a selection across a track and keep the audio in sync.

By Thomas Rombach @Thomas_Rombach
    2021-09-27 15:20:43.591Z

    Hi @Kitch

    I kindly ask for help with a new script for a workflow i want to set up.

    I have two tracks. The first ist completly rendered with Mouth Deklick.
    The second Track is the original File.

    Now i want to replace a portion of the deklicked Track with audio from the original File.

    The two tracks are grouped and i am in shuffle mode.

    The steps are:

    1. make a waveform selection
    2. seperate it with keyboard command b
    3. ungroup the tracks with cmd + shift + g
    4. change from shuffle two slip
    5. select the new selection with the grabber tool on the second track
    6. drag and drop it to the frist track while holding control + option to keep it in sync
    7. group the tracks again with cmd + shift + g
    8. change from slip to shuffle

    I managed steps 1 to 4 with makros but i don’t get step 5 and 6 to work.

    I made a video to make the workflow more clear.

    https://1drv.ms/v/s!AtFp95uPV6S1gY9GgRGtgP4z1V8F1Q?e=PKfglk

    Thomas

    • 9 replies
    1. You're on the right track. Instead of trying to drag the clip from one track to another just copy the selection, select the destination track and then paste.

      You're video link doesn't work for me so I went by the workflow you posted:

      // Get Track Names
      const origSelectedTracks = sf.ui.proTools.selectedTrackNames;
      
      // Separate clip
      sf.ui.proTools.menuClick({
          menuPath: ["Edit", "Separate Clip", "At Selection"],
      });
      
      // Suspend Groups
      sf.ui.proTools.mainWindow.buttons.whoseTitle.is("Group List pop-up").first.popupMenuSelect({
          menuPath: ["Suspend All Groups"],
      });
      
      // Slip Mode
      sf.ui.proTools.editModeSet({
          mode: "Slip",
      });
      
      // Select Second track
      sf.ui.proTools.trackSelectByName({
          names: [origSelectedTracks[1]]
      });
      
      // Brief pause
      sf.wait({intervalMs:50});
      
      //Copy Selection
      sf.ui.proTools.menuClick({
          menuPath: ["Edit", "Copy"],
      });
      // Select First Track
      sf.ui.proTools.trackSelectByName({
          names:[origSelectedTracks[0]]
      });
      // Brief pause
      sf.wait({intervalMs:50})
      
      // Paste onto first track
      sf.ui.proTools.menuClick({
          menuPath: ["Edit", "Paste"]
      });
      // Turn on Groups
      sf.ui.proTools.mainWindow.buttons.whoseTitle.is("Group List pop-up").first.popupMenuSelect({
          menuPath: ["Suspend All Groups"],
      });
      // Shuffle Mode
      sf.ui.proTools.editModeSet({
          mode: "Shuffle",
      });
      
      1. Kitch Membery @Kitch2021-09-27 18:56:30.156Z

        Nice one @Chris_Shaw :-)
        Thank you!

      2. T
        In reply toThomas_Rombach:
        Thomas Rombach @Thomas_Rombach
          2021-09-28 06:14:08.687Z

          Works perfect. Thank you very much Chris. That helped a lot.
          I will study your script to improve my skills with soundflow.

          1. T
            In reply toThomas_Rombach:
            Thomas Rombach @Thomas_Rombach
              2022-06-19 09:45:00.697Z

              The script is running into a issue on a mac mini M1 with pro tools 2021/12. I don't know if this constellation is the reason but on intel imac with pro tools 2021/7 everything works finde.
              Error Code is:

              Expected String but got Undefined (Outlander line20)

              I aprreciate your help.

              1. TThomas Rombach @Thomas_Rombach
                  2023-05-25 12:03:57.929Z

                  I still have the problem with the Script
                  (Expected String but got Undefined (line20)

                  I am on Pro Tools 2022.12

                  Kitch, could you please help. I am working on large project an need the script very urgent.

                  1. cc @Kitch

                    1. In reply toThomas_Rombach:
                      Kitch Membery @Kitch2023-05-26 16:51:05.152Z

                      Hi @Thomas_Rombach,

                      I think I know what is causing the issue. Have you got "Link Track and Edit Selection" enabled in Pro Tools? If "Link Track and Edit Selection" is not enabled the script will display the error you are seeing.

                      The button in Pro Tools looks like this.

                      You can also enable "Link Track and Edit Selection" from the Pro Tools "Option" menu.

                      1. In reply toThomas_Rombach:
                        Kitch Membery @Kitch2023-05-26 16:53:27.523Z

                        Let me know if the issue persists, and if so I'll take another look :-)

                    2. T
                      In reply toThomas_Rombach:
                      Thomas Rombach @Thomas_Rombach
                        2023-05-27 13:39:44.799Z

                        Your tip was great. It solved the problem. Thank you for your fast support.