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

Broken Script in Pro Tools 2024.10

By Nacho @Nacho_Sotelo
    2024-11-05 19:37:03.951Z

    Title

    Broken Script in Pro Tools 2024.10

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

    Bypasses the last 2 inserts on a track, its working on protools 2024.6, broken in pro tools 2024.10

    Are you seeing an error?

    Couldn't get item #0 as the array length was 0 - sf.ui.app ('com.avid.ProTools').windows.first.popUpButtons.whoseTitle.startsWith('Plug-In Selector').first (AxElementArrayIndexedItem) (borrar 2: Line 44)

    What happens when you run this script?

    works in 2024.6 broken in 2024.10

    How were you running this script?

    I clicked the "Run Script" or "Run Macro" button in SoundFlow

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "Bypasses the last 2 inserts on a track, its working on protools 2024.6, broken in pro tools 2024.10",
        "inputIsError": true,
        "inputError": "Couldn't get item #0 as the array length was 0 -\nsf.ui.app ('com.avid.ProTools').windows.first.popUpButtons.whoseTitle.startsWith('Plug-In Selector').first\n(AxElementArrayIndexedItem) (borrar 2: Line 44)",
        "inputWhatHappens": "works in 2024.6 broken in 2024.10",
        "inputHowRun": {
            "key": "-MpfwYA4I6GGlXgvp5j1",
            "title": "I clicked the \"Run Script\" or \"Run Macro\" button in SoundFlow"
        },
        "inputImportance": 5,
        "inputTitle": "Broken Script in Pro Tools 2024.10"
    }

    Source

     //Activate Protools Main Window
            sf.ui.proTools.appActivateMainWindow();
            sf.ui.proTools.mainWindow.invalidate();
    
            sf.ui.proTools.mainWindow.counterDisplay.mouseClickElement({
                relativePosition: { x: 299, y: 67 }
            });
            
            sf.ui.proTools.trackSelectByName({
                names: ["Mix Bus"],
            });
    
            // ------ DISABLE LIMITERS (Insert 9 and 10)
            function bypassInsert(insertNumber) {
                function getInsertState(getInsertStateNo) {
                    var val = sf.ui.proTools.selectedTrack.insertSelectorButtons[getInsertStateNo - 1].value.invalidate().value;
                    return {
                        isBypassed: val.indexOf('bypassed') >= 0,
                        isInactive: val.indexOf('inactive') >= 0,
                    };
                }
    
                var states = getInsertState(insertNumber)
                var bypassState = states.isBypassed;
                var inactivaState = states.isInactive;
    
                if (inactivaState == true) {
                    // log(`Insert "${insertNumber}" is inactive`)
                }
                else {
                    //  log(`Insert "${insertNumber}" is active`)
    
                    if (bypassState == true) {
                        // log(`Insert "${insertNumber}" is bypassed`)
                    }
                    else {
                        // log(`Insert "${insertNumber}" is not bypassed`)
                        // ----- AQUI VIENE LO BUENO
                        sf.ui.proTools.trackGetByName({ name: "Mix Bus", makeVisible: true }).track.trackInsertToggleShow({
                            insertNumber: insertNumber,
                            targetValue: "Enable",
                        });
    
                        var pluginName = sf.ui.proTools.windows.first.popupButtons.whoseTitle.startsWith('Plug-In Selector').first.value.invalidate().value;
                        var trackName = 'Mix Bus';
                        // const insertNumber = insertNumber;
    
                        function bypassToggleInsert(trackName, pluginName, insertNumber) {
                            sf.ui.proTools.appActivateMainWindow();
                            sf.ui.proTools.mainWindow.invalidate();
    
                            //----- Make sure Inserts A-J are visible
                            //sf.ui.proTools.menuClick({ menuPath: ['View', 'Edit Window Views', 'Inserts A-E'], targetValue: 'Enable' });
                            //sf.ui.proTools.menuClick({ menuPath: ['View', 'Edit Window Views', 'Inserts F-J'], targetValue: 'Enable' });
    
                            //----- Get track by name
                            var track = sf.ui.proTools.trackGetByName({ name: trackName }).track;
    
                            //Show the plugin
                            // sf.ui.proTools.trackGetByName({ name: trackName, makeVisible: true }).track.trackInsertToggleShow({
                            //     insertNumber: insertNumber,
                            //     targetValue: "Enable",
                            // });
    
                            //Plugin Window
                            var pluginWindow = sf.ui.proTools.windows.whoseTitle.is('Plug-in: ' + pluginName).first;
                            //Wait For plugin window
                            pluginWindow.elementWaitFor();
    
                            //Bypass Button
                            var effectsBypassBtn = pluginWindow.buttons.whoseTitle.is("Effect Bypass").first;
    
                            //Toggle Bypass Button
                            if (effectsBypassBtn.value.invalidate().value !== 'on') {
                                effectsBypassBtn.elementClick();
                                log(`The plugin "${pluginName}" on track "${track.normalizedTrackName}" was bypassed`);
                            } else {
                                log(`The plugin "${pluginName}" on track "${track.normalizedTrackName}" is bypassed`);
                            }
    
                            //Close Plugin Window
                            pluginWindow.windowClose();
                        }
    
                        bypassToggleInsert(trackName, pluginName, insertNumber);
    
                    };
                };
            }; // ---- Aqui acaba bypassInsert function
    
            bypassInsert(9);
            bypassInsert(10);
    

    Links

    User UID: DHDnZWdpvKemqgJbKRnLwKuVEx52

    Feedback Key: sffeedback:DHDnZWdpvKemqgJbKRnLwKuVEx52:-OAxp96Mkqe_gNRP7OVk

    Feedback ZIP: n1cyrUytx35jSThu/afTU0OT9enaFzPdcvsxGXJD/0DWiJp1GHE9NkalZaoX6qZJU1RZ9278JYh5kkdVOGjDG5HTMdc9bAIpRrYLtEPhpyiG72stc2zRsX3HWSR/In06zF/Rts70ch+qX+d7+OTh0VK93FV/ze2q420rh2FmEXdDIdb1bCrFThnICWDC7hs7ijkFgl0/ud3ULhSBXf74R+E3PCtGGV0WIaUVwTTKjkh1O7dsqKicdeQE6qafsk7nN1soKlLjeWoADBGjKGYtYi5oHDnx0jlIAohkQ51TJwJe6iTHUpFDc2xDF1fXgji3xGy81CAmC6srM87EDJvvWQ==

    • 3 replies
    1. Kitch Membery @Kitch2024-11-05 19:43:53.444Z

      Hi @Nacho_Sotelo,

      Thanks for reaching out about this. Try Changing line 44 to this...

      var pluginName = sf.ui.proTools.windows.first.popupButtons.whoseTitle.startsWith('Plugin Selector').first.value.invalidate().value;
      

      Avid made a change in the most recent version of Pro Tools where all instances of "plug-in" had the hyphen removed.

      I hope that fixes the issue for you!

      1. NNacho @Nacho_Sotelo
          2024-11-05 19:45:19.822Z

          yes, this fixes it :) Thanks @Kitch !

          1. Kitch Membery @Kitch2024-11-05 19:45:39.268Z

            Awesome!