No internet connection
  1. Home
  2. How to

A simple way to copy a playlist name

By Peter Rydberg @Peter_Rydberg
    2021-11-08 16:16:02.771Z2021-11-10 01:22:59.475Z

    Hi! Slowly expanding my SF workflow and could use an assist. I do a lot of versioning of huge numbers of TV spots with multiple unique phone numbers. I've automated parts of this process, but could use a simple way to copy a playlist name without having to double click on a selected playlist, copy, and hit return. This seems like a good place to start, but would need to substitute "Comment" with the playlist name:

    function setComment(trackHeader, text) {
        var commentsField = trackHeader.textFields.whoseTitle.startsWith('Comments').first;
        commentsField.mouseClickElement();
        sf.keyboard.press({ keys: 'cmd+c' });
        sf.keyboard.press({ keys: 'return' });
    

    Any advice? Thanks in advance!

    • 46 replies

    There are 46 replies. Estimated reading time: 27 minutes

    1. samuel henriques @samuel_henriques
        2021-11-08 17:00:56.088Z

        Hello Peter,

        When you say "copy a playlist name" is this the same as the track name? When you change the playlist on the track, the track name changes as well.

        this will get you the selected track name.

        Let me know if this is it.

        const selectedTracKName = sf.ui.proTools.selectedTrackNames[0]
        
        log(selectedTracKName)
        
        1. PPeter Rydberg @Peter_Rydberg
            2021-11-08 17:44:02.378Z

            Here's a more clear way of explaining it: I have a single track with up to 400 different playlists, all being viewed at once. Each playlist is labeled with a unique phone number. I need to copy and paste each unique number into a new bounce to disk window. I currently have the task broken up into three steps. One script selects the next unique playlist and solos that playlist. I then manually double click the playlist name. The next script copies that playlist name, hits "OK" the UI window, then cycles through bouncing to disk dialogue, enters the new playlist name, and renders the file.

            I'm largely doing this through key commands and not through UI automation, but I'm slogging my way through learning more and better ways to do things....

            1. samuel henriques @samuel_henriques
                2021-11-08 21:15:22.650Z2021-11-08 21:52:32.400Z

                Hello Peter,

                I managed this, it will solo each playlist, and get its name.
                Now we need to add the bounce part.

                As it is now, it will do it for all Comp tracks (playlist tracks) in the session, so, keep open only the one you want to bounce.

                If you run it just the way it is, you should see it select each playlist at a time, and log its name.

                Send me the bounce part you have if you get stuck.

                function bounceToDisk(bounceName) {
                
                    log(bounceName)
                
                    // here goes your bounce script, and must include a wait for bounce to finish
                
                }
                
                const compTracks = sf.ui.proTools.visibleTrackHeaders.filter(track => track.title.value.endsWith("- Comp Track "))
                
                const playlistTracks = compTracks.map(track => ({
                    playlistName: track.normalizedTrackName,
                    soloBtn: track.children.filter(x => x.title.value === "Solo Comp Lane")[0]
                
                }))
                
                
                playlistTracks.forEach(playlist => {
                
                    // Press solo
                    playlist.soloBtn.elementClick()
                
                    // Bouce
                    bounceToDisk(playlist.playlistName)
                
                })
                
                
                
                
                
                1. samuel henriques @samuel_henriques
                    2021-11-09 17:13:12.669Z2021-11-09 18:33:06.195Z

                    Hey Peter, I'm working on a version that will do it for all playlist in the selected track. You would only need to select the track you have the playlists to bounce and the script will do the rest.

                    Could you confirm if the playlists you commonly need, are the ones in red? And do you bounce the first in menu, meaning the selected playlist?

                    1. samuel henriques @samuel_henriques
                        2021-11-09 18:48:19.262Z

                        The reason i'm thinking about this method is so the script would know the names of the playlists to solo, instead of the way the first script works, where it's searching the complete list of tracks in the session for playlist tracks.

                        Another way could be inputing the list of phone numbers to the script and then ask the script to find the playlist tracks and bounce them. This would be advantageous in the event there is a mistake with naming or missing the playlists. We could then report a specific number wasn't found or is missing, for example.

                        Let me know if ay of this makes sense.

                        1. PPeter Rydberg @Peter_Rydberg
                            2021-11-09 19:01:51.802Z2021-11-10 01:24:38.904Z

                            Amazing! The best way to make this work wouldn't be to bounce every playlist at once in each track. I usually have multiple spots spread across the timeline and need to specify a range to bounce and since the number of successive bounces always changes, the function can't work as "bounce all of these playlists." Hopefully that makes sense. Here's the workflow in more detail:

                            First, I'd select a range to bounce. Then:

                            1. Select and solo playlist
                            2. Copy name of playlist
                            3. Call up Bounce To Disk UI
                            4. Copy name of playlist to File Name
                            5. Activate bounce function

                            I'd repeat this for manually for each successive playlist. Ultimately, this script would be a generic "one-shot" button press.

                            Here's how I've got these 3 parts scripted at the moment:

                            1. Select next playlist and solo
                            sf.keyboard.press({
                                keys: "semicolon",
                            });
                            
                            sf.keyboard.press({
                                keys: "shift+s",
                            });
                            
                            1. Then I manually double click the playlist name.
                            2. Copy/paste name and bounce to disk:
                            const selectedTracKName = sf.ui.proTools.selectedTrackNames[0]
                            
                            log(selectedTracKName)
                            
                            
                            sf.keyboard.press({
                                keys: "cmd+c",
                            });
                            
                            sf.ui.proTools.focusedWindow.buttons.whoseTitle.is("OK").first.elementClick();
                            
                            sf.keyboard.press({
                                keys: "cmd+alt+b",
                            });
                            
                            sf.keyboard.press({
                                keys: "tab",
                            });
                            
                            sf.keyboard.press({
                                keys: "cmd+v",
                            });
                            
                            sf.keyboard.press({
                                keys: "return",
                            });
                            

                            Hope this makes things clearer. The assistance you're providing is invaluable - thanks so much.

                            P.

                            1. samuel henriques @samuel_henriques
                                2021-11-09 19:39:58.435Z2021-11-09 19:56:34.016Z

                                okok. so this should do what you described, apart from the select next and solo at the start of the script.
                                It's making more sense, for me, doing that in the end, but it's an easy change, just let me know.

                                So you make a selection, and solo the one you want and run the script.

                                Let me know how it goes.

                                
                                function bounceMix(name) {
                                
                                    sf.ui.proTools.menuClick({ menuPath: ["File", "Bounce Mix..."] })
                                
                                    const bounceMixWin = sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.elementWaitFor({}, "Cound not open Bounce Mix window.").element
                                
                                    bounceMixWin.textFields.first.elementSetTextFieldWithAreaValue({ value: name });
                                
                                    bounceMixWin.buttons.whoseTitle.is("Bounce").first.elementClick();
                                
                                    bounceMixWin.elementWaitFor({ waitType: "Disappear" }, "Bounce Mix Window did not close.")
                                
                                    //Wait for bounce to finish
                                    sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Disappear', timeout: -1 }); //-1 is endless timeout (cancel by Ctrl+Shift+Esc)
                                
                                }
                                
                                
                                sf.ui.proTools.appActivateMainWindow()
                                sf.ui.proTools.invalidate()
                                
                                
                                const soloed = sf.ui.proTools.visibleTrackHeaders.filter(track =>
                                    track.title.value.endsWith("- Comp Track ") &&
                                    track.children.filter(x => x.title.value === "Solo Comp Lane"
                                        && x.value.invalidate().value === "on state")[0]
                                )[0];
                                
                                if (soloed) {
                                
                                    bounceMix(soloed.normalizedTrackName)
                                
                                    // Select Next
                                    sf.keyboard.press({ keys: "semicolon" });
                                
                                    // Solo track
                                    sf.keyboard.press({ keys: "shift+s" });
                                
                                
                                } else {
                                    alert("Please solo a playlist track.")
                                };
                                
                                
                                1. samuel henriques @samuel_henriques
                                    2021-11-09 19:41:40.614Z

                                    Make sure to check out this video to learn how to quote code in the forum:
                                    How to quote code in the SoundFlow forum.

                                    1. samuel henriques @samuel_henriques
                                        2021-11-09 19:57:46.862Z

                                        UPDATED, there was a mistake on the first one and simplified the code.

                          • P
                            In reply toPeter_Rydberg:
                            Peter Rydberg @Peter_Rydberg
                              2021-11-09 21:16:47.772Z

                              Hmm, doesn't seem to do it. I copied and pasted that script to a new button on my deck, selected a range, solo'd the playlist I was targeting, and got this Soundflow message in Pro Tools:

                              "Please solo a playlist track."

                              Thoughts?

                              1. samuel henriques @samuel_henriques
                                  2021-11-09 21:24:16.591Z2021-11-09 21:33:27.217Z

                                  That warning was meant to show if there is no playlist soloed.
                                  Could you send me a screen pic of the track with the visible playlists and the soloed one?
                                  I might have missed something.

                                  1. PPeter Rydberg @Peter_Rydberg
                                      2021-11-09 21:51:14.849Z
                                      1. samuel henriques @samuel_henriques
                                          2021-11-09 22:07:23.092Z

                                          Could you quit and open soundFlow and try again please?

                                          1. PPeter Rydberg @Peter_Rydberg
                                              2021-11-09 22:15:41.073Z

                                              Nope, same result.

                                              1. samuel henriques @samuel_henriques
                                                  2021-11-09 22:29:57.804Z

                                                  keeping the playlist soloed, can you run this code and send me the result?

                                                  sf.ui.proTools.appActivateMainWindow()
                                                  sf.ui.proTools.invalidate()
                                                  
                                                  
                                                  const soloed = sf.ui.proTools.visibleTrackHeaders.filter(track =>
                                                      track.title.value.endsWith("- Comp Track ") &&
                                                      track.children.filter(x => x.title.value === "Solo Comp Lane"
                                                          && x.value.invalidate().value === "on state")[0]
                                                  )[0];
                                                  
                                                  alert(JSON.stringify(soloed))
                                                  
                                                  1. samuel henriques @samuel_henriques
                                                      2021-11-09 23:00:29.956Z

                                                      Hey @Kitch, hope you are doing well.

                                                      could you run this to see if it works for you?

                                                      create a few playlists on a track, solo one, and run the script.

                                                      Thank you so much.

                                                      1. Kitch Membery @Kitch2021-11-09 23:03:22.186Z

                                                        Hi mate!

                                                        Am working on something right now, however, I should be done in the next hour so I'll check it out asap.

                                                        Rock on!

                                                        1. Kitch Membery @Kitch2021-11-10 01:41:55.776Z

                                                          Sorry for the delay... It seems to be working here @samuel_henriques.

                                                          Maybe if @Peter_Rydberg could do a screen recording that might help to work out what's happening.

                                                          Rock on!

                                                          1. Kitch Membery @Kitch2021-11-10 02:16:37.609Z

                                                            @samuel_henriques,

                                                            I thought I'd do a quick refactor to see if I could find any problems, but it was mostly just adjusting variable and function names, formatting, and substituting the keyboard shortcut for moving to the next track. This shouldn't work any differently to your script. (But I thought I'd share the refactor anyway.)

                                                            /**
                                                             * @param {string} name
                                                             */
                                                            function bounceSelection(name) {
                                                                sf.ui.proTools.menuClick({
                                                                    menuPath: ["File", "Bounce Mix..."],
                                                                });
                                                            
                                                                const bounceMixWin = sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first
                                                            
                                                                bounceMixWin.elementWaitFor({}, "Cound not open Bounce Mix window.").element;
                                                            
                                                                bounceMixWin.textFields.first.elementSetTextFieldWithAreaValue({
                                                                    value: name,
                                                                });
                                                            
                                                                bounceMixWin.buttons.whoseTitle.is("Bounce").first.elementClick({}, `Could not click "Bounce."`);
                                                            
                                                                bounceMixWin.elementWaitFor({ waitType: "Disappear" }, `The "Bounce Mix Window" did not close.`);
                                                            
                                                                //Wait for bounce to finish
                                                                sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Disappear', timeout: -1 }); //-1 is endless timeout (cancel by Ctrl+Shift+Esc)
                                                            }
                                                            
                                                            function solotNextTrack() {
                                                                sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Selection', 'Extend Edit Down'] });
                                                                sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Selection', 'Remove Edit from Top'] });
                                                            
                                                                sf.keyboard.press({ keys: "shift+s" });
                                                            }
                                                            
                                                            function main() {
                                                                sf.ui.proTools.appActivateMainWindow()
                                                                sf.ui.proTools.invalidate()
                                                            
                                                                const soloedPlaylist = sf.ui.proTools.visibleTrackHeaders.filter(track =>
                                                                    track.title.value.endsWith("- Comp Track ") &&
                                                                    track.children.filter(playlist =>
                                                                        playlist.title.value === "Solo Comp Lane" &&
                                                                        playlist.value.invalidate().value === "on state")[0]
                                                                )[0];
                                                            
                                                                if (soloedPlaylist) {
                                                                    let soloedPlaylistName = soloedPlaylist.normalizedTrackName;
                                                            
                                                                    //Bounce Selection
                                                                    bounceSelection(soloedPlaylistName);
                                                            
                                                                    //Solo Next Track
                                                                    solotNextTrack();
                                                            
                                                                } else {
                                                                    alert("Please solo a playlist track.")
                                                                };
                                                            }
                                                            
                                                            main();
                                                            

                                                            I'll follow this thread to see if anything arises.
                                                            Rock on!

                                                            1. samuel henriques @samuel_henriques
                                                                2021-11-10 10:12:34.568Z

                                                                Cool, thank you Kitch.
                                                                And thank you for the refactor, it certainly helps readability.

                                                                1. Kitch Membery @Kitch2021-11-10 10:13:33.945Z

                                                                  You’re welcome, legend! :-)

                                                                  1. PPeter Rydberg @Peter_Rydberg
                                                                      2021-11-11 17:25:19.781Z

                                                                      Hi folks -

                                                                      Again, really can't express enough gratitude for the assist here. Unfortunately, I'm still getting this SF message when running the script:

                                                                      "Please solo a playlist track."

                                                                      I'd be happy to do a screen capture - should I post it into this thread?

                                                                      1. Kitch Membery @Kitch2021-11-11 17:59:37.977Z

                                                                        Yes that would be great :-)

                                                                        1. PPeter Rydberg @Peter_Rydberg
                                                                            2021-11-11 18:17:37.928Z
                                                                            1. samuel henriques @samuel_henriques
                                                                                2021-11-11 18:24:03.083Z

                                                                                Thank you Peter,

                                                                                This is you doing it manually.
                                                                                This is what the script should do.
                                                                                Could you show us a video when trying to use the script?

                                                                                1. samuel henriques @samuel_henriques
                                                                                    2021-11-11 18:54:08.812Z2021-11-11 19:13:41.750Z

                                                                                    Just noticed, as well, we are not on same pro tools versions.
                                                                                    What is the Pro tools version you are using?

                                                                                    1. PPeter Rydberg @Peter_Rydberg
                                                                                        2021-11-11 22:14:19.873Z

                                                                                        That's probably the issue. Currently on Ultimate 2019.12 which isn't compatible. I'm installing 2020.12 as we speak and will report back with updates. I'm obviously very slow to institute changes to a stable system... ;)

                                                                                        1. Kitch Membery @Kitch2021-11-11 22:16:22.479Z

                                                                                          Sounds good Peter. Keep @samuel_henriques and I posted. :-)

                                                                                          Rock on!

                                                                                          1. PPeter Rydberg @Peter_Rydberg
                                                                                              2021-11-11 22:30:04.575Z

                                                                                              Ok, PT Ultimate 2020.12 is now running smoothly. Copied the script, dropped it into SF, added to a button on my Android device running the app, pressed the button, and this video is the result.

                                                                                              1. Kitch Membery @Kitch2021-11-11 22:37:27.440Z

                                                                                                Hi Peter,

                                                                                                I think you uploaded the video from before where you are doing the steps manually. Can you check that?

                                                                                                1. PPeter Rydberg @Peter_Rydberg
                                                                                                    2021-11-11 22:51:45.612Z
                                                                                                    1. Kitch Membery @Kitch2021-11-11 22:54:40.318Z

                                                                                                      No worries.. I do stuff like that at least five times a day! Haha

                                                                                                      Can you try making an audio selection and running the script again?
                                                                                                      Also are you in Full Screen mode for Pro Tools?

                                                                                                      1. PPeter Rydberg @Peter_Rydberg
                                                                                                          2021-11-12 20:35:56.434Z
                                                                                                          1. samuel henriques @samuel_henriques
                                                                                                              2021-11-12 21:05:51.863Z

                                                                                                              hey Peter, I'm sorry this is taking so long. The first time is correct, the script should warn if no track is soloed. But the second try should work. I'm really missing something here, because I can't reproduce the behaviour you are getting.

                                                                                                              Soloing one playlist, can you try this and send me a pic of the alert?

                                                                                                              sf.ui.proTools.appActivateMainWindow()
                                                                                                              sf.ui.proTools.invalidate()
                                                                                                              
                                                                                                              
                                                                                                              const soloedPlaylist = sf.ui.proTools.visibleTrackHeaders.filter(track =>
                                                                                                                  track.title.value.endsWith("- Comp Track ") &&
                                                                                                                  track.children.filter(playlist =>
                                                                                                                      playlist.title.value === "Solo Comp Lane" &&
                                                                                                                      playlist.value.invalidate().value === "on state")[0]
                                                                                                              )[0];
                                                                                                              
                                                                                                              alert(JSON.stringify(soloedPlaylist))
                                                                                                              
                                                                                                              1. Kitch Membery @Kitch2021-11-12 21:14:09.785Z

                                                                                                                For what it's worth @samuel_henriques, I get an alert of the track object;

                                                                                                                1. samuel henriques @samuel_henriques
                                                                                                                    2021-11-12 21:21:57.614Z

                                                                                                                    exactly, thats what I get as well. For me, the only way to go to the "Please solo a playlist track." alert is if the soloedPlaylist is undefined. If Peter gets the object, there should be something else.

                                                                                                                    1. Kitch Membery @Kitch2021-11-12 21:31:41.072Z

                                                                                                                      @Peter_Rydberg,

                                                                                                                      Just a thought...

                                                                                                                      Could you check in "Pro Tools" => "Preferences..." => Display Tab => Tool Tips (Function & Details checkboxes are both checked).

                                                                                                                      1. samuel henriques @samuel_henriques
                                                                                                                          2021-11-12 21:33:59.357Z

                                                                                                                          ahh good one, that makes if fail for me.

                                                                                                                          1. PPeter Rydberg @Peter_Rydberg
                                                                                                                              2021-11-12 21:36:08.556Z

                                                                                                                              I turned off Tool Tips about a hundred years ago. ;) Definitely not the issue here.

                                                                                                                              Let me try the previously suggested path. Standby!

                                                                                                                              1. Kitch Membery @Kitch2021-11-12 21:42:55.809Z

                                                                                                                                I'm not sure I was clear in my last message...

                                                                                                                                If you have Tool tips turned off the script will not work. Both the "Function" & "Details" checkboxes both need to be enabled as in the above screenshot.

                                                                                                                                Without them enabled the script will not work as expected.

                                                                                                                                Hope that makes sense.

                                                                                                                                1. PPeter Rydberg @Peter_Rydberg
                                                                                                                                    2021-11-12 22:12:39.819Z

                                                                                                                                    Eureka! After turning on Tool Tips, this works 100% as advertised:

                                                                                                                                    To say that this is nothing short of monumental to my workflow for these types of projects would be a massive understatement. I kludged my way through this before with some ugly Avid Dock shortcuts, but this is a game changer. You have my unending gratitude. Cheers, gents!

                                                                                                                                    1. Kitch Membery @Kitch2021-11-12 22:17:06.614Z

                                                                                                                                      So glad we could work it out @Peter_Rydberg!

                                                                                                                                      Nice work as always @samuel_henriques :-)

                                                                                                                                      Rock on!

                                                                                                                                      1. samuel henriques @samuel_henriques
                                                                                                                                          2021-11-12 22:41:19.402Z

                                                                                                                                          Awesome!!! Really happy it's working.
                                                                                                                                          Thank you for the help @Kitch .

                                                                                                                                          1. Kitch Membery @Kitch2021-11-12 22:44:12.152Z

                                                                                                                                            A pleasure as always, legend!

                                                                                                                                  • Kitch Membery @Kitch2021-11-12 21:36:41.399Z

                                                                                                                                    Note: It's also a SoundFlow requirement that the Pro Tools language should also be set to English but it looks like Peter has his set to english. :-)

                                                                                                                                    1. PPeter Rydberg @Peter_Rydberg
                                                                                                                                        2022-02-16 21:22:26.820Z

                                                                                                                                        Hi everyone! Before I go any further, congrats on the new SF5 release - it's a game changer!

                                                                                                                                        Sooooooo... this script continues to be unbelievably great, but I'm thinking it could be even greater. Would it be possible to introduce an option to specify bouncing every playlist in a track automatically without having to select and bounce each playlist manually? Let me know what you think. And thanks in advance!