No internet connection
  1. Home
  2. How to

New Playlist & Duplicate Playlist

By John McPhillips @John_McPhillips
    2023-03-29 10:35:21.798Z

    Hi All - does anyone know if there's a macro/script for creating a new playlist or duplicating current playlist when a track is selected?

    Thanks

    John

    • 7 replies
    1. Chris Shaw @Chris_Shaw2023-03-29 20:34:23.959Z2023-03-29 22:56:52.486Z

      This script will create a new playlist for selected tracks.
      Read the comments to modify it to duplicate tracks

      sf.ui.proTools.appActivateMainWindow();
      sf.ui.proTools.mainWindow.invalidate();
      
      // substitute "New..." with "Duplicate..." to duplicate track
      const trackAction = "New..."
      
      //Get selected Track Names
      const originalSelectedTracks = sf.ui.proTools.selectedTrackNames;
      
      //Select first track and make sure it is scrolled into view
      sf.ui.proTools.trackSelectByName({
          names: [originalSelectedTracks[0]]
      })
      
      sf.ui.proTools.selectedTrack.trackScrollToView()
      
      //Reselect originally selected tracks
      sf.ui.proTools.trackSelectByName({ names: originalSelectedTracks })
      
      //Duplicate or Create New Tracks depending on value of `trackAction`
      sf.ui.proTools.selectedTrack.popupButtons.whoseTitle.is("Playlist selector").first.popupMenuSelect({
          isShift: true,
          isOption: true,
          menuPath: [trackAction]
      })
      
      //Delete everything below this line if you want to name the playlist
      //otherwise the script will automatically click "OK" to close confirmation dialog
      
      
      //If only one track is originally selected, wait for the confirmation dialog
      sf.wait({ intervalMs: 300 })
      
      const confDialog = sf.ui.proTools.confirmationDialog
      
      //close conmf dialog
      if (confDialog.exists && originalSelectedTracks.length == 1) {
          sf.ui.proTools.windows.first.buttons.whoseTitle.is("OK").first.elementClick()
      }
      
      1. JJohn McPhillips @John_McPhillips
          2023-03-30 09:10:04.344Z

          Hi Chris - thank you so much, this is exactly what I was after. I'm hopeless at coding/scripting... One day, one day I'll knuckle down and save you all this bother.

          Cheers

          John

          1. In reply toChris_Shaw:
            MMitch Lee @Mitch_Lee
              2026-01-20 17:22:20.068Z

              I tried this script however I get the following error.
              Running Pro Tools Ultimate 2025.10.0

              Link to .log file
              https://www.dropbox.com/scl/fi/35pqxgonujdgn4bq26ngm/soundflow.20260120.main.log?rlkey=a46ilsp84m0w1yjc107sxfb7l&dl=0

              1. Chris Shaw @Chris_Shaw2026-01-20 18:08:58.263Z2026-01-20 21:54:26.286Z

                For PT 25.10 and higher replace "New…" with "New Playlist" and "Duplicate…" with "Duplicate Main Playlist"

                1. MMitch Lee @Mitch_Lee
                    2026-01-20 23:00:23.618Z

                    Great! that works.

                    1. In reply toChris_Shaw:
                      HHelder Hans @Helder_Hans
                        2026-02-17 15:52:04.376Z

                        Hi Chris,
                        the "OK" button is not working anymore.
                        I had to change line 38 for this to work:

                        sf.ui.proTools.focusedWindow.buttons.whoseTitle.is("OK").first.elementClick()
                        
                  • P
                    In reply toJohn_McPhillips:
                    Paul Fawcus @Paul_Fawcus
                      2024-09-04 13:32:17.062Z

                      Thanks for this!