No internet connection
  1. Home
  2. How to

Pro Tools Create A Marker With Location Number In Title

By Lance Crowder @Lance_Crowder
    2024-09-18 23:09:10.168Z

    I've made a macro in the past that could copy and paste the location number in the name of the marker, but with the newer version of markers in pro tools I there's no way to command c to copy it. So I'm unsure if there's a way to actually copy that number and paste it in the text field.

    An example would be: it's my first marker so it would be labeled "1. intro" and My 2nd marker would be labeled "2. verse 1" or "2. hook". I'm able to click the button on my deck that has the name of the marker I want and then paste the number marker in front of it. If that makes sense.

    My biggest issue is really just finding a way to copy and paste that number into the text field now.

    Solved in post #2, click to view
    • 4 replies
    1. D
      danielkassulke @danielkassulke
        2024-09-19 10:50:00.568Z2024-09-19 21:06:11.165Z

        Hey Lance,

        I got heaps of help for this from the forum:

        function newMemoryLocation(name, startTime) {
            sf.app.proTools.createMemoryLocation({
                name,
                startTime,
                colorIndex: 1
            });
        }
        
        function main() {
            sf.ui.proTools.appActivateMainWindow();
        
            // Get Memory Locations
            const memLocs = sf.app.proTools.memoryLocations.invalidate().allItems.map(memLoc => ({ number: memLoc.number, name: memLoc.name }));
        
            const markerName = "HELLO WORLD";
            const customMarkers = memLocs.filter(memLoc => memLoc.name.includes(markerName));
        
            // Read next marker number
            const nextMarkerNumber = customMarkers.length === 0
                ? 1
                : Math.max(...customMarkers.map(memLoc => parseInt(memLoc.name.split(markerName)[1] || "0", 10))) + 1;
        
            // Position of marker
            const mainCounterValue = sf.ui.proTools.mainWindow.counterDisplay.textFields.whoseTitle.is("Main Counter").first.value.value;
        
            const newMarkerName = `${memLocs.length + 1}. ${markerName} ${nextMarkerNumber}`;
            newMemoryLocation(newMarkerName, mainCounterValue);
        }
        
        main();
        

        Specify your marker name in line 15. The great thing with this script is that it reads the memory location table, and it looks for previous instances of the marker name, so if you set the marker name to 'verse', it will automatically name the first one 'verse 1', the second one 'verse 2' etc. I have a lot of these made up from templates.

        ReplySolution
        1. L
          In reply toLance_Crowder:
          Lance Crowder @Lance_Crowder
            2024-09-19 18:10:54.744Z

            Thanks so much!

            Is there potentially something above that first line? Line 6 is saying it's broken I believe. And nothing happens when I activate it. I'm still really new to the actual script side of things so I'm not sure what I could add to close it.

            1. Ddanielkassulke @danielkassulke
                2024-09-19 20:56:44.422Z

                Hi Lance - yes, sorry. I had omitted a line break. Should be working now!

              • L
                In reply toLance_Crowder:
                Lance Crowder @Lance_Crowder
                  2024-09-19 21:30:40.504Z

                  Thanks so much!! Works great.