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

Delete Memory Locations based on their name

By Luke Dunn Gielmuda @Luke_Dunn_Gielmuda
    2024-01-04 20:58:18.990Z

    Title

    Delete Memory Locations Script Broken - Pleas help fix!

    What do you expect to happen when you run the script/macro?

    This Script Delete's all markers on the timeline that start with the word Location. Since updating to Pro tools v23.12.0.136 it no longer works. I need help to update it to work again please?

    Thanks

    Are you seeing an error?

    What happens when you run this script?

    The memory Locations window does pop up for a split second then it closes. Before updating Pro tools it would stay open and the script deletes a marker starting with the word location one at a time, then it closes.

    How were you running this script?

    Other

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "This Script Delete's all markers on the timeline that start with the word Location.\nSince updating to Pro tools v23.12.0.136  it no longer works.\nI need help to update it to work again please?\n\nThanks",
        "inputIsError": false,
        "inputWhatHappens": "The memory Locations window does pop up for a split second then it closes.  Before updating Pro tools it would stay open and the script deletes a marker starting with the word location one at a time, then it closes.",
        "inputHowRun": {
            "key": "-MpfwoFyZNOpBC3X5xGI",
            "title": "Other"
        },
        "inputImportance": 5,
        "inputTitle": "Delete Memory Locations Script Broken - Pleas help fix!"
    }

    Source

    function clearMemoryLocations(name) {
    
        const isMemLocWinOpened = sf.ui.proTools.getMenuItem('Window', 'Memory Locations').isMenuChecked
    
        // //  Open mem loc win
        sf.ui.proTools.memoryLocationsShowWindow()
    
        // Get Memory Locations including...
        const memoryLocations = sf.proTools.memoryLocationsFetch().collection['List'].filter(m => m.name.includes(name))
    
        // Clear found
        memoryLocations.forEach(memLoc => {
            sf.ui.proTools.memoryLocationsGoto({ memoryLocationNumber: memLoc.number })
            sf.ui.proTools.memoryLocationsWindow.popupButtons.first.popupMenuSelect({ menuPath: ['Clear*'], useWildcards: true });
        });
    
    
    
    
        // Set initial state of Mem Loc Win
        if (!isMemLocWinOpened) {
            sf.ui.proTools.menuClick({ menuPath: ['Window', 'Memory Locations'], targetValue: "Disable" })
        };
    };
    
    
    
    clearMemoryLocations('Location')
    
    
    

    Links

    User UID: nd6Qe53F7GZkvB9oRsB1wJsVINy2

    Feedback Key: sffeedback:nd6Qe53F7GZkvB9oRsB1wJsVINy2:-NnLGFmHkmHeec7W8e4n

    Feedback ZIP: BcdiS0ddf1j43MB/8oH4Ip5NI0RZxDWA+KEqDNfjPe5aIwrVUW/cSvwWrs6pYmR5fuI/7bfAoMSfznAwZQEnysRh+y4N8f9DPX1/ePS+GyxOnY8BvqORJddH22YbTxdZ0jVaI1MCNy1vw1RWeMYWwTvkRwBbpJv2CV12doaU2Tod5Yv4gGA+M5vhMVUiHMTcRLqCKgEjWmV34zT0xwh0V8C8Z2f7OFBIoITjQQtGeyGwJqQP6XPRSW/RdOhkzN2O34c9wgJcM5R9EQVRn58/yIbNJlPd2oMvAiNl7WaR46K2meU9WZK2DSdnLvvA+vDakIIe+rwB4lj99Ql5RRNz5w==

    Solved in post #2, click to view
    • 9 replies
    1. Hi Luke,

      Thanks for posting here :)

      Try using this script instead:

      
      var numbersToDelete = [];
      
      for (let memLoc of Array.from(sf.app.proTools.memoryLocations.allItems)) {
          if (memLoc.name.startsWith('Location')) {
              numbersToDelete.push(memLoc.number);
          }
      }
      
      sf.app.proTools.clearMemoryLocations({
          numbers: numbersToDelete,
      });
      
      
      ReplySolution
      1. wow, that works way faster than my original! thank you Christian.

        1. Thanks, Luke - I'm happy it helped.

          1. Hi Christian, unfortunately i've now run in to some issues with it. firstly it would randomly stop working and the only way for it to work would be to restart Soundflow. But even worse once i started having track markers it randomly deletes markers on those tracks that's names did not contain "Location".

            1. Hi Luke,

              I don't know why it would delete markers with names not containing Location, but it could be that it contains an old cache of memory locations that don't currently get invalidated.

              To fix that, try inserting this as a first line in the script:

              sf.app.proTools.memoryLocations.invalidate();
              
              1. That's fixed it. I'll keep you posted if anything else odd happens. thanks!

        2. In reply tochrscheuer:
          CChava Solís @Chava_Solis
            2024-08-12 16:06:32.201Z

            I tried this code but it won't work. I wonder if it has to do with ProTools updates or if I'm doing something wrong.

            Soundflow shows this message:

            1. @Chava_Solis, you're using a very, very old version of SoundFlow (5.4.6). Be sure to update here (5.8.1 is the most recent as of this writing):
              https://soundflow.org/account/downloads

              1. CChava Solís @Chava_Solis
                  2024-08-12 21:35:36.337Z

                  Thank you, Chris. Worked like magic.