No internet connection
  1. Home
  2. Macro and Script Help

Track Titling Macro

By S. @S23
    2025-08-13 17:17:21.410Z

    Hi all! I'm hoping to get some help with two track titling macros:

    1- Make all letters CAPITAL (for example: "Drum Kit" would change to "DRUM KIT")

    2- Make only the first letter of each word Capital (for example: "drum kit"/"DRUM KIT" would change to "Drum Kit")

    It would be awesome if each macro was un-doable (I have a ALL CAPS macro but it's not un-doable). But, if that's not possible, that's ok b/c these two macro's essentially cancel each other out.

    Thank you in advance for any help :)

    Solved in post #2, click to view
    • 4 replies
    1. Matt Friedman @Matt_Friedman
        2025-08-13 18:02:40.216Z2025-08-13 19:19:22.213Z

        Try this. Included lower case. (It's not un-doable though, but it's faster this way). title is "Title Case"

        /**
         * Change the case of all selected Pro Tools track names.
         *
         * @param {"upper"|"lower"|"title"} caseStyle - Desired case style
         */
        function trackNamesCaseChange(caseStyle = "upper") {
            sf.app.proTools.tracks.invalidate();
        
            sf.app.proTools.tracks.allItems
                .filter(t => t.isSelected)
                .forEach(t => {
                    let newName;
        
                    switch (caseStyle) {
                        case "lower":
                            newName = t.name.toLowerCase();
                            break;
                        case "title":
                            newName = t.name
                                .toLowerCase()
                                .replace(/\b\w/g, char => char.toUpperCase());
                            break;
                        case "upper":
                        default:
                            newName = t.name.toUpperCase();
                    }
        
                    if (t.name !== newName) sf.app.proTools.renameTrack({ oldName: t.name, newName });
                });
        }
        
        trackNamesCaseChange("title"); // "upper", "lower", or "title"
        
        Reply2 LikesSolution
        1. SS. @S23
            2025-08-13 18:59:02.450Z

            @Matt_Friedman Works great!! But I am getting an error:

            "Names should be different (Capitalize First Letter: Line 28)"

            But it's functioning as expected, so ?? haha.

            Thank you for your help :)

            1. Matt Friedman @Matt_Friedman
                2025-08-13 19:17:01.613Z

                You could change

                sf.app.proTools.renameTrack({ oldName: t.name, newName });
                

                To

                if (t.name !== newName) sf.app.proTools.renameTrack({ oldName: t.name, newName });
                
                1. SS. @S23
                    2025-08-13 19:29:34.367Z

                    Amazing!! That fixed the error :)

                    Thank you!!