No internet connection
  1. Home
  2. How to

Cut/Paste from Playlist to Track.

By Mike Wax @mikewax
    2020-11-22 18:45:30.246Z

    Hello!

    I am trying to cut and paste a clip from a PLAYLIST to a specific track.

    Very similar to the post below:
    https://forum.soundflow.org/-1628/cut-and-paste-to-specific-track-for-foleyadr

    The difference is I'm going from a playlist > track instead of a track > track. Pro Tools seems to be doing this weird thing with Playlists where the playhead stays on the playlist even when a different track is selected.

    Playlists are more desirable for this instance since i am using the Loop Record and creating new playlists for each new recording. This is for a template that i have setup for multiple phone recordings using different VO artists.

    Here is a copy of the script i have now. This basically selects the track based on what you selected from the list prompt. Which "Vertical or Script" to use, and which "VO artist" to use. Each "Vertical" has a different script.

    So I'm trying to cut the clip from each playlist, then paste it to track with the correct script.

    var vertical = ["LEGAL", "MEDICAL", "HOME SERVICES"];
    var voArtist = ["WAX", "CHERELLE", "INGRID"];
    
    sf.ui.proTools.menuClick({
        menuPath: ["Edit", "Cut"],
    });
    
    var selectedVertical = sf.interaction.popupSearch({
        items: vertical.map(name => ({ name: name })),
        title: "Select your Vertical",
    }).item.name;
    
    var selectedVOArtist = sf.interaction.popupSearch({
        items: voArtist.map(name => ({ name: name })),
        title: "Select your VO Artist"
    }).item.name;
    
    sf.ui.proTools.trackDeselectAll();
    
    // SELECT TRACK
    sf.ui.proTools.trackSelectByName({
        names: [selectedVertical + " - " + selectedVOArtist],
        deselectOthers: true,
    });
    
    sf.ui.proTools.appActivate();
    
    sf.ui.proTools.menuClick({
        menuPath: ["Edit", "Paste"],
    });
    

    Here's a screen shot of the example. Let me know if this isn't making any sense.

    When i paste it, it pastes onto the Playlist instead of the selected track.


    Thank you for the help!
    • 12 replies

    There are 12 replies. Estimated reading time: 12 minutes

    1. Kitch Membery @Kitch2020-11-23 11:10:16.126Z

      Hi Mike,

      I can see how this would be a timesaver!

      To understand a bit better... How would you perform this task step by step manually?

      1. Mike Wax @mikewax
          2020-11-23 16:38:29.492Z

          Hey Kitch,

          I have a list of clients names that need to be recorded. I simply load up that list in a Google Sheet and enter int loop record.

          I than have the VO artist (sometimes myself) just run through the list of client names for the "recorded section" (Thank you for calling BLAH BLAH).

          After the recorded portion is done, I have a script that i setup to run through the playlisted tracks, and use Strip Silence to trim all the excess from the tracks and set them to the start of the session.

          There are 3 different verticals (or script templates) that each VO needs to get placed with based on the client. For example, the 3 verticals are LEGAL, MEDICAL, and HOME SERVICES (as I'm sure you guessed, LOL). That's what this script is for.

          This script is to help match the correct client with the correct vertical. For example, if a client is The Law Office of Kitch, that would be a LEGAL template, or Kitch's Tree Trimming Services would be a HOME SERVICE template. In the Google Sheet with all the client names, I have a column that tells me which vertical each client belongs to.

          The ultimate plan is to rename each clip with the correct vertical, then the script can say "if the clip says LEGAL, copy and paste it to the LEGAL template. etc." But I'm getting hung up on the COPY/PASTE part, lol.

          After it copies and pastes to the correct template, it will bounce the file out for delivery. I do this once a week, and have an average of about 30-50 per week, so you can see how valuable this script will be for me.

          Let me know if that all makes sense. Thank you so much for the help! I'm very excited to get this script working and save me HOURS every week!

          1. Mike Wax @mikewax
              2020-11-23 16:43:14.043Z

              Also, here's the other script i have in case that helps with understanding the process.

              
              sf.ui.proTools.appActivate();
              
              
              // SAVE THE SESSION BEFORE IT GETS FUCKED UP
              sf.keyboard.press({
                  keys: "cmd+s",
              });
              
              // DISABLE TAB TO TRANSIENT
              sf.ui.proTools.menuClick({
                  menuPath: ["Options", "Tab to Transient"],
                  targetValue: 'Disable'  // or 'Enable' or 'Toggle'
              });
              
              // CHANGE THE EDIT MODE TO SHUFFLE
              sf.ui.proTools.editModeSet({
                  mode: "Shuffle",
              });
              
              // OPEN STRIP SILENCE
              sf.ui.proTools.menuClick({
                  menuPath: ["Edit", "Strip Silence"],
              });
              
              var repeat = prompt("How many IVRs do you have?");
              
              for(var i=0; i < +repeat; i++) {
                  sf.keyboard.press({
                      keys: "return",
                  });
              
                  sf.keyboard.press({
                      keys: "shift+tab",
                  });
              
                  sf.wait({
                      intervalMs: 200,
                  });
              
                  sf.ui.proTools.windows.whoseTitle.is('Strip Silence').first.buttons.whoseTitle.is('Strip').first.elementClick();
              
                  sf.wait({
                      intervalMs: 200,
                  });
                  
              // RENAME CLIP TO VERTICAL
                  sf.ui.proTools.menuClick({
                      menuPath: ["Clip", "Rename..."],
                  });
              
                  sf.wait({
                      intervalMs: 200,
                  });
              
                  sf.ui.app('com.google.Chrome').appActivate();
                  sf.ui.app('com.google.Chrome').appWaitForActive();
              
                  sf.keyboard.press({
                      keys: "cmd+c",
                  });
              
                  sf.keyboard.press({
                      keys: "down",
                  });
              
                  sf.ui.proTools.appActivate();
                  sf.ui.proTools.appWaitForActive();
              
                  sf.keyboard.press({
                      keys: "cmd+a",
                  });
              
                  sf.wait({
                      intervalMs: 100,
                  });
              
                  sf.keyboard.press({
                      keys: "cmd+v",
                  });
              
                  sf.wait({
                      intervalMs: 200,
                  });
              
                  sf.ui.proTools.windows.whoseTitle.is('Name').first.buttons.whoseTitle.is('OK').first.elementClick();
              
              // END RENAME
              
                  sf.keyboard.press({
                      keys: "return",
                  });
              
                  sf.keyboard.press({
                      keys: "shift+tab",
                  });
              
                  sf.keyboard.press({
                      keys: "backspace",
                  });
              
                  sf.keyboard.press({
                      keys: "semicolon",
                  });
              }
              
              // CLOSE STRIP SILENCE
              sf.ui.proTools.menuClick({
                  menuPath: ["Edit", "Strip Silence"],
              });
              
              1. In reply tomikewax:
                Kitch Membery @Kitch2020-11-23 19:22:14.174Z

                Nice!

                Try this out;

                var vertical = ["LEGAL", "MEDICAL", "HOME SERVICES"];
                var voArtist = ["WAX", "CHERELLE", "INGRID"];
                
                var selectedVertical = sf.interaction.popupSearch({
                    items: vertical.map(name => ({ name: name })),
                    title: "Select your Vertical",
                }).item.name;
                
                var selectedVOArtist = sf.interaction.popupSearch({
                    items: voArtist.map(name => ({ name: name })),
                    title: "Select your VO Artist"
                }).item.name;
                
                sf.ui.proTools.menuClick({
                    menuPath: ["Edit", "Cut"],
                });
                
                sf.ui.proTools.trackSelectByName({
                    names: [selectedVOArtist + " - " + selectedVertical],
                    deselectOthers: true,
                });
                
                sf.ui.proTools.menuClick({
                    menuPath: ["Edit", "Selection","Remove Edit from Top"],
                });
                
                sf.ui.proTools.menuClick({
                    menuPath: ["Edit", "Paste"],
                });
                
                1. In reply tomikewax:
                  Kitch Membery @Kitch2020-11-23 19:38:33.611Z

                  Or better still, you can make SoundFlow fetch the Clip name for you like this;

                  //VO Artist Names
                  const voArtist = ["WAX", "CHERELLE", "INGRID"];
                  
                  //Select VO Artist from popup menu
                  const selectedVOArtist = sf.interaction.popupSearch({
                      items: voArtist.map(name => ({ name: name })),
                      title: "Select your VO Artist"
                  }).item.name;
                  
                  //Open Rename Window
                  sf.ui.proTools.menuClick({ menuPath: ["Clip", "Rename..."] });
                  
                  //Variable for Rename Window
                  const win = sf.ui.proTools.windows.whoseTitle.is('Name').first;
                  
                  //Wait for Rename Window to appear
                  win.elementWaitFor();
                  
                  //Get the Clip name from the "Name" text field
                  let selectedVertical = win.groups.whoseTitle.is('Name').first.textFields.whoseTitle.is('').first.value.invalidate().value;
                  
                  //Click "OK" to close window
                  sf.ui.proTools.windows.whoseTitle.is('Name').first.buttons.whoseTitle.is('OK').first.elementClick();
                  
                  //Wait for Rename Window to Disappear 
                  win.elementWaitFor({waitType:'Disappear'});
                  
                  //Cut Clip
                  sf.ui.proTools.menuClick({
                      menuPath: ["Edit", "Cut"],
                  });
                  
                  //Select VO Artist Track with coresponding Selected Vertical
                  sf.ui.proTools.trackSelectByName({
                      names: [selectedVOArtist + " - " + selectedVertical],
                      deselectOthers: true,
                  });
                  
                  //Deselect the above track
                  sf.ui.proTools.menuClick({
                      menuPath: ["Edit", "Selection","Remove Edit from Top"],
                  });
                  
                  //Paste Clip
                  sf.ui.proTools.menuClick({
                      menuPath: ["Edit", "Paste"],
                  });
                  
                  1. Mike Wax @mikewax
                      2020-11-24 02:40:59.810Z2020-11-24 02:48:54.400Z

                      This is great!! The "Remove Edit From Top" is exactly what i needed. Had no idea that even existed.

                      The only thing is it doesn't seem to be selecting the track after the cut. I even tried re-activing pro tools aftterwards.

                      Question: what is const and what's the difference between using that and var?

                      Thank you so much for the help!

                      UPDATED: I solved it. The variales were backwards. It needed to be selectedVertical - selected VOArtist

                      1. Kitch Membery @Kitch2020-11-24 02:45:16.248Z

                        You are welcome mate. "Remove Edit From Top" is a new addition to Pro Tools from the last release I think. Super handy.

                        Can you explain this "Now i just need an IF statement to match it with the correct vertical!" to me?

                        1. Mike Wax @mikewax
                            2020-11-24 02:52:28.951Z

                            I was jumping the gun on that...LOL. My mistake. I realized that you're copying the vertical and using that.

                            Once i switched the select track criteria it all worked flawlessly just like you suspected.

                            Can you explain the use of const and let? What are they for? And when would you use those instead of var?
                            Thank you again! I love conversing with smart people!

                            1. Kitch Membery @Kitch2020-11-24 03:31:20.258Z

                              Awesome! Nice one Mike!

                              Let me think of the best way to describe it to you... I don't want to confuse. I'll get back to you. :-)

                              Rock on!

                              1. In reply tomikewax:
                                Kitch Membery @Kitch2020-11-25 01:54:29.282Z

                                Hi @Mike_Wax,

                                Here is a great article that I found that walks through the differences between var,let & const,.

                                https://www.freecodecamp.org/news/var-let-and-const-whats-the-difference/

                                The short version is that it is best to declare a variable using let instead of var as let is scope specific (cannot be accessed through function walls). And use const to declare variables that will not change after they have first been declaired.

                                Hope that make sense. :-)

                                1. Mike Wax @mikewax
                                    2020-11-25 01:55:52.397Z

                                    Thank you so much!

                                    1. Kitch Membery @Kitch2020-11-25 01:56:25.021Z

                                      You are welcome Mike :-)