No internet connection
  1. Home
  2. How to

Help with this script...keeps bugging me out!

By Philip weinrobe @Philip_weinrobe
    2024-02-20 16:08:48.123Z

    hi geniuses!
    I have this AMAZING little script which selects all tracks that have a plugin with an asterisk in the name. this is how i differentiate my hardware inserts so I can find them all and commit them without error.

    i've been using this script for a couple years i think and it's always worked...but sometimes it just fails! I can't seem to figure out what is causing the issue and I was hoping someone here could help look at this code and maybe find a weak spot?

    Thank you all so much!

    sf.ui.proTools.appActivateMainWindow();
    sf.ui.proTools.mainWindow.invalidate();
    sf.ui.proTools.trackDeselectAll();
    
    // Ensure Inserts are visible
    const AEInsertsMenuPath = ['View', 'Edit Window Views', 'Inserts A-E']
    const FJInsertsMenuPath = ['View', 'Edit Window Views', 'Inserts F-J']
    
    const insertsAEShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts A-E').isMenuChecked;
    const insertsFJShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts F-J').isMenuChecked;
    
    if (!insertsAEShowing) sf.ui.proTools.menuClick({ menuPath: AEInsertsMenuPath, targetValue: "Enable" });
    if (!insertsFJShowing) sf.ui.proTools.menuClick({ menuPath: FJInsertsMenuPath, targetValue: "Enable" });
    
    // Get visible track headers
    const visibleTracks = sf.ui.proTools.visibleTrackHeaders;
    
    //filter out tracks that are VCA and Basic Folder
    const tracksWithInserts = visibleTracks.filter(tr =>
        !tr.title.value.includes("Basic Folder Track") &&
        !tr.title.value.includes("VCA Track") &&
        !tr.title.value.includes("MIDI Track") &&
        !tr.title.value.includes("Video Track")
    );
    
    //Declare tracks with hw inserts variable
    var tracksWithHWInserts = [];
    
    //Loop through tracks with inserts, look at each insert name and find track whose insert names contain "hw"
    // if found, add to tracksWInserts array
    tracksWithInserts.forEach(track => {
        // sf.ui.proTools.trackSelectByName({ names: [track] })
        for (var i = 0; i < 10; i++) {
            var insertName = track.insertButtons[i].value.invalidate().value;
            if (insertName.includes("*") || insertName.includes("Trackspacer")) { tracksWithHWInserts.push(track) };
        };
    });
    
    // select tracks with hw inserts
    sf.ui.proTools.trackSelectByName({ names: tracksWithHWInserts.map(th => th.normalizedTrackName) });
    

    and here is the error i get
    20.02.2024 11:06:38.23 [EditorWindow:Renderer]: Active Focus Container: app Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js
    20.02.2024 11:06:39.91 [Backend]: [KeyboardInterfaceController] #Key: ctrl+command+alt+shift+p (35) -> HW INSERT FIND TEST [clsuk21su0001qt107k2ap8fj]

    20.02.2024 11:06:39.91 [Backend]: >> Command: HW INSERT FIND TEST [user:cktj8p6a80003y610qt32zw39:clsuk1z7j0000qt10p0rop9ny]

    20.02.2024 11:06:39.92 [Backend]: [NSRunningApplication (static)] Checking for running apps with bundle 'com.avid.ProTools'

    20.02.2024 11:06:39.92 [Backend]: NSArray.ArrayFromHandle count = 1

    20.02.2024 11:06:39.93 [StartMenu]: StartMenuContainer currentPageKey='home' Line 24630 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar//dist/bundle.js
    20.02.2024 11:06:39.100 [Backend]: Mouse current pos is: (1198.9686279296875, 261.18719482421875)
    Clicking with mouse here: (12, 62)

    20.02.2024 11:06:40.00 [Backend]: Moving mouse back to: (1198.9686279296875, 261.18719482421875)

    20.02.2024 11:06:40.01 [Backend]: Position is now: (1198.9686279296875, 261.18719482421875)

    20.02.2024 11:06:40.12 [Backend]: Could not get UIElement for AxPtTrackInsertSendButton: Could not get trackInserts/Sends. {
    "title": "Inserts A-E",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Insert selector A",
    "description": "Insert selector A",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector B",
    "description": "Insert selector B",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector C",
    "description": "Insert selector C",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector D",
    "description": "Insert selector D",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment A",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment B",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment C",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment D",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    }
    ]
    }
    {
    "title": "Sends A-E",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Send selector A",
    "description": "Send selector A",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send Assignment A",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send selector B",
    "description": "Send selector B",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send Assignment B",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send selector C",
    "description": "Send selector C",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send Assignment C",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send selector D",
    "description": "Send selector D",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send Assignment D",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    }
    ]
    }
    {
    "title": "Audio IO",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Audio Input Path selector\n"Gtr Mix"",
    "description": "Audio Input Path selector\n"Gtr Mix"",
    "role": "AXPopUpButton",
    "fullRole": "AXPopUpButton"
    },
    {
    "title": "Output Window button",
    "description": "Output Window button",
    "role": "AXButton",
    "fullRole": "AXButton"
    },
    {
    "title": "Audio Output Path selector\nINST (Stereo)",
    "description": "Audio Output Path selector\nINST (Stereo)",
    "role": "AXPopUpButton",
    "fullRole": "AXPopUpButton"
    },
    {
    "title": "Volume",
    "description": null,
    "role": "AXSlider",
    "fullRole": "AXSlider"
    },
    {
    "title": "Audio Pan indicator\n<100",
    "description": null,
    "role": "AXSlider",
    "fullRole": "AXSlider"
    },
    {
    "title": "Audio Pan indicator\n100>",
    "description": null,
    "role": "AXSlider",
    "fullRole": "AXSlider"
    }
    ]
    }
    {
    "title": "Markers View",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Target Track for Markers",
    "description": "Target Track for Markers",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Prioritize Marker Name vs Comment",
    "description": "Prioritize Marker Name vs Comment",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Add Marker",
    "description": "Add Marker",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    }
    ]
    }
    {
    "title": "Inserts F-J",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Insert selector F",
    "description": "Insert selector F",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector G",
    "description": "Insert selector G",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector H",
    "description": "Insert selector H",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector I",
    "description": "Insert selector I",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment F",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment G",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment H",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment I",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    }
    ]
    }

    20.02.2024 11:06:40.12 [Backend]: !! Command Error: HW INSERT FIND TEST [user:cktj8p6a80003y610qt32zw39:clsuk1z7j0000qt10p0rop9ny]:
    Could not get trackInserts/Sends. {
    "title": "Inserts A-E",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Insert selector A",
    "description": "Insert selector A",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector B",
    "description": "Insert selector B",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector C",
    "description": "Insert selector C",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector D",
    "description": "Insert selector D",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment A",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment B",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment C",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment D",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    }
    ]
    }
    {
    "title": "Sends A-E",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Send selector A",
    "description": "Send selector A",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send Assignment A",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send selector B",
    "description": "Send selector B",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send Assignment B",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send selector C",
    "description": "Send selector C",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send Assignment C",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send selector D",
    "description": "Send selector D",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Send Assignment D",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    }
    ]
    }
    {
    "title": "Audio IO",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Audio Input Path selector\n"Gtr Mix"",
    "description": "Audio Input Path selector\n"Gtr Mix"",
    "role": "AXPopUpButton",
    "fullRole": "AXPopUpButton"
    },
    {
    "title": "Output Window button",
    "description": "Output Window button",
    "role": "AXButton",
    "fullRole": "AXButton"
    },
    {
    "title": "Audio Output Path selector\nINST (Stereo)",
    "description": "Audio Output Path selector\nINST (Stereo)",
    "role": "AXPopUpButton",
    "fullRole": "AXPopUpButton"
    },
    {
    "title": "Volume",
    "description": null,
    "role": "AXSlider",
    "fullRole": "AXSlider"
    },
    {
    "title": "Audio Pan indicator\n<100",
    "description": null,
    "role": "AXSlider",
    "fullRole": "AXSlider"
    },
    {
    "title": "Audio Pan indicator\n100>",
    "description": null,
    "role": "AXSlider",
    "fullRole": "AXSlider"
    }
    ]
    }
    {
    "title": "Markers View",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Target Track for Markers",
    "description": "Target Track for Markers",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Prioritize Marker Name vs Comment",
    "description": "Prioritize Marker Name vs Comment",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Add Marker",
    "description": "Add Marker",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    }
    ]
    }
    {
    "title": "Inserts F-J",
    "description": null,
    "role": "AXGroup",
    "fullRole": "AXGroup",
    "children": [
    {
    "title": "Insert selector F",
    "description": "Insert selector F",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector G",
    "description": "Insert selector G",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector H",
    "description": "Insert selector H",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert selector I",
    "description": "Insert selector I",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment F",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment G",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment H",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    },
    {
    "title": "Insert Assignment I",
    "description": "",
    "role": "AXButton",
    "fullRole": "AXButton:AXToggle"
    }
    ]
    } (AxPtTrackInsertSendButton) (HW INSERT FIND TEST: Line 34)

    20.02.2024 11:06:40.12 [Backend]: << Command: HW INSERT FIND TEST [user:cktj8p6a80003y610qt32zw39:clsuk1z7j0000qt10p0rop9ny]

    20.02.2024 11:06:40.12 [StartMenu]: StartMenuContainer currentPageKey='home' Line 24630 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar//dist/bundle.js
    20.02.2024 11:06:40.13 [StartMenu]: StartMenuContainer currentPageKey='home' Line 24630 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar//dist/bundle.js
    20.02.2024 11:06:42.35 [EditorWindow:Renderer]: Active Focus Container: app Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js
    20.02.2024 11:06:50.21 [Backend]: [SF_FIREBASE_WS]: Sending keep-alive

    • 8 replies
    1. Nathan Salefski @nathansalefski
        2024-02-20 16:49:33.713Z2024-02-20 17:28:13.642Z

        Seems like you were super close, just a few typos. You can also take out the for loop in line 33 of your original code. Try this:

        function main() {
            sf.ui.proTools.appActivateMainWindow();
            sf.ui.proTools.mainWindow.invalidate();
        
            const aEInsertMenuPath = ['View', 'Edit Window Views', 'Inserts A-E'];
            const fJInsertMenuPath = ['View', 'Edit Window Views', 'Inserts F-J'];
        
            const insertsAEShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts A-E');
            const insertsFJShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts F-J');
        
            if (!insertsAEShowing.isMenuChecked) {
                sf.ui.proTools.menuClick({
                    menuPath: aEInsertMenuPath,
                    targetValue: "Enable"
                });
            }
        
            if (!insertsFJShowing.isMenuChecked) {
                sf.ui.proTools.menuClick({
                    menuPath: fJInsertMenuPath,
                    targetValue: "Enable"
                });
            }
        
            sf.ui.proTools.trackDeselectAll();
        
            const visibleTracks = sf.ui.proTools.invalidate().visibleTrackHeaders;
        
            //filter out tracks that are VCA and Basic Folder
            const tracksWithInsertButtons = visibleTracks.filter(tr =>
                !tr.title.value.includes("Basic Folder Track") &&
                !tr.title.value.includes("VCA Track") &&
                !tr.title.value.includes("MIDI Track") &&
                !tr.title.value.includes("Video Track")
            );
        
            let tracksWithHWInserts = [];
        
            tracksWithInsertButtons.forEach(track => {
                let trackHasHardwareInsert = track.insertButtons.filter(btn => btn.value.invalidate().value.includes("*"))[0];
        
                let trackHasTrackspacer = track.insertButtons.filter(btn => btn.value.invalidate().value.includes("Trackspacer"))[0];
        
                if (trackHasHardwareInsert || trackHasTrackspacer) {
                    tracksWithHWInserts.push(track);
                }
            });
        
            sf.ui.proTools.trackSelectByName({ names: tracksWithHWInserts.map(th => th.normalizedTrackName) });
        }
        
        main();
        
        1. PPhilip weinrobe @Philip_weinrobe
            2024-02-20 20:52:54.103Z

            thanks so much! unfortunately...same error.

            20.02.2024 15:51:56.49 <info> [Backend]: Could not get UIElement for AxPtTrackInsertSendButton: Could not get trackInserts/Sends. {
              "title": "Inserts A-E",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Insert selector A",
                  "description": "Insert selector A",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert selector B",
                  "description": "Insert selector B",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert selector C",
                  "description": "Insert selector C",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment A",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment B",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment C",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                }
              ]
            }
            {
              "title": "Sends A-E",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Send selector A",
                  "description": "Send selector A",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send Assignment A",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send selector B",
                  "description": "Send selector B",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send Assignment B",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send selector C",
                  "description": "Send selector C",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send Assignment C",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                }
              ]
            }
            {
              "title": "Audio IO",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Audio Input Path selector\n\"Gtr Mix\"",
                  "description": "Audio Input Path selector\n\"Gtr Mix\"",
                  "role": "AXPopUpButton",
                  "fullRole": "AXPopUpButton"
                },
                {
                  "title": "Output Window button",
                  "description": "Output Window button",
                  "role": "AXButton",
                  "fullRole": "AXButton"
                },
                {
                  "title": "Audio Output Path selector\nINST (Stereo)",
                  "description": "Audio Output Path selector\nINST (Stereo)",
                  "role": "AXPopUpButton",
                  "fullRole": "AXPopUpButton"
                },
                {
                  "title": "Volume",
                  "description": null,
                  "role": "AXSlider",
                  "fullRole": "AXSlider"
                },
                {
                  "title": "Audio Pan indicator\n<100",
                  "description": null,
                  "role": "AXSlider",
                  "fullRole": "AXSlider"
                },
                {
                  "title": "Audio Pan indicator\n100>",
                  "description": null,
                  "role": "AXSlider",
                  "fullRole": "AXSlider"
                }
              ]
            }
            {
              "title": "Markers View",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Target Track for Markers",
                  "description": "Target Track for Markers",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Prioritize Marker Name vs Comment",
                  "description": "Prioritize Marker Name vs Comment",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Add Marker",
                  "description": "Add Marker",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                }
              ]
            }
            {
              "title": "Inserts F-J",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Insert selector F",
                  "description": "Insert selector F",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert selector G",
                  "description": "Insert selector G",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert selector H",
                  "description": "Insert selector H",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment F",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment G",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment H",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                }
              ]
            }
            
            20.02.2024 15:51:56.50 <info> [Backend]: !! Command Error: Hardware Insert Find [user:cktj8p6a80003y610qt32zw39:clsuubb5u00007210hx9vw5f6]:
            Could not get trackInserts/Sends. {
              "title": "Inserts A-E",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Insert selector A",
                  "description": "Insert selector A",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert selector B",
                  "description": "Insert selector B",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert selector C",
                  "description": "Insert selector C",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment A",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment B",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment C",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                }
              ]
            }
            {
              "title": "Sends A-E",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Send selector A",
                  "description": "Send selector A",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send Assignment A",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send selector B",
                  "description": "Send selector B",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send Assignment B",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send selector C",
                  "description": "Send selector C",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Send Assignment C",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                }
              ]
            }
            {
              "title": "Audio IO",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Audio Input Path selector\n\"Gtr Mix\"",
                  "description": "Audio Input Path selector\n\"Gtr Mix\"",
                  "role": "AXPopUpButton",
                  "fullRole": "AXPopUpButton"
                },
                {
                  "title": "Output Window button",
                  "description": "Output Window button",
                  "role": "AXButton",
                  "fullRole": "AXButton"
                },
                {
                  "title": "Audio Output Path selector\nINST (Stereo)",
                  "description": "Audio Output Path selector\nINST (Stereo)",
                  "role": "AXPopUpButton",
                  "fullRole": "AXPopUpButton"
                },
                {
                  "title": "Volume",
                  "description": null,
                  "role": "AXSlider",
                  "fullRole": "AXSlider"
                },
                {
                  "title": "Audio Pan indicator\n<100",
                  "description": null,
                  "role": "AXSlider",
                  "fullRole": "AXSlider"
                },
                {
                  "title": "Audio Pan indicator\n100>",
                  "description": null,
                  "role": "AXSlider",
                  "fullRole": "AXSlider"
                }
              ]
            }
            {
              "title": "Markers View",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Target Track for Markers",
                  "description": "Target Track for Markers",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Prioritize Marker Name vs Comment",
                  "description": "Prioritize Marker Name vs Comment",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Add Marker",
                  "description": "Add Marker",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                }
              ]
            }
            {
              "title": "Inserts F-J",
              "description": null,
              "role": "AXGroup",
              "fullRole": "AXGroup",
              "children": [
                {
                  "title": "Insert selector F",
                  "description": "Insert selector F",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert selector G",
                  "description": "Insert selector G",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert selector H",
                  "description": "Insert selector H",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment F",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment G",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                },
                {
                  "title": "Insert Assignment H",
                  "description": "",
                  "role": "AXButton",
                  "fullRole": "AXButton:AXToggle"
                }
              ]
            } (AxPtTrackInsertSendButton) (Hardware Insert Find: Line 40)
            
            1. Nathan Salefski @nathansalefski
                2024-02-20 20:56:30.477Z

                Could you tell me what version of Mac OS, SoundFlow and Pro Tools you’re running?

                1. PPhilip weinrobe @Philip_weinrobe
                    2024-02-20 20:58:04.352Z

                    OS: 13.13.1
                    PT: 2023.9
                    SF: 5.5.3

                    the weird thing is the script works sometimes
                    for the life of me i can't figure out what is the cause of the fail/success.

                    1. Nathan Salefski @nathansalefski
                        2024-02-20 21:02:26.178Z

                        Try updating to SoundFlow 5.5.4 and maybe it’ll help. If not could you send a screen recording of it failing?

                        1. PPhilip weinrobe @Philip_weinrobe
                            2024-02-20 21:13:04.886Z

                            here's a video
                            notice it works when i close my folders down, i tried to go through a few processes so you can see.
                            but when i open the folders and put the HW inserts on a track (or a folder)...buggy.

                            1. Nathan Salefski @nathansalefski
                                2024-02-20 21:39:26.326Z

                                I see two issues here. Firstly, when the parent folder is closed, visibleTracks = sf.ui.proTools.invalidate().visibleTrackHeaders; doesn't register the children of that folder because they are in fact not visible. Secondly, when your track size is in between medium and small and not all of the inserts are shown, it throws the error Could not get trackInserts/Sends.... This is because 4 of the 10 insert buttons are not visible. Try this:

                                function main() {
                                    sf.ui.proTools.appActivateMainWindow();
                                    sf.ui.proTools.mainWindow.invalidate();
                                
                                    const aEInsertMenuPath = ['View', 'Edit Window Views', 'Inserts A-E'];
                                    const fJInsertMenuPath = ['View', 'Edit Window Views', 'Inserts F-J'];
                                
                                    const insertsAEShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts A-E');
                                    const insertsFJShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts F-J');
                                
                                    if (!insertsAEShowing.isMenuChecked) {
                                        sf.ui.proTools.menuClick({
                                            menuPath: aEInsertMenuPath,
                                            targetValue: "Enable"
                                        });
                                    }
                                
                                    if (!insertsFJShowing.isMenuChecked) {
                                        sf.ui.proTools.menuClick({
                                            menuPath: fJInsertMenuPath,
                                            targetValue: "Enable"
                                        });
                                    }
                                
                                    // Ensures all Folder Tracks are Open
                                    let folderTracks = sf.ui.proTools.invalidate().visibleTrackHeaders.filter(track => track.title.value.endsWith("Folder Track "))
                                
                                    folderTracks.forEach(folder => {
                                        folder.folderTrackSetOpen({ targetValue: "Enable" });
                                    })
                                
                                    let visibleTracks = sf.ui.proTools.invalidate().visibleTrackHeaders;
                                
                                    // Filters Tracks without Insert Buttons
                                    const tracksWithInsertButtons = visibleTracks.filter(tr =>
                                        !tr.title.value.includes("Basic Folder Track") &&
                                        !tr.title.value.includes("VCA Track") &&
                                        !tr.title.value.includes("MIDI Track") &&
                                        !tr.title.value.includes("Video Track")
                                    );
                                
                                    let tracksWithHWInserts = [];
                                
                                    tracksWithInsertButtons.forEach(track => {
                                        let trackHasHardwareInsert = track.insertButtons.filter(btn => btn.value.invalidate().value.includes("*"))[0];
                                
                                        let trackHasTrackspacer = track.insertButtons.filter(btn => btn.value.invalidate().value.includes("Trackspacer"))[0];
                                
                                        if (trackHasHardwareInsert || trackHasTrackspacer) {
                                            tracksWithHWInserts.push(track);
                                        }
                                    });
                                
                                    sf.ui.proTools.trackSelectByName({
                                        names: tracksWithHWInserts.map(th => th.normalizedTrackName),
                                        deselectOthers: true
                                    });
                                }
                                
                                main();
                                
                    2. In reply toPhilip_weinrobe:

                      Just a heads up - when posting long error messages it's best to post them the same way you would post code. Makes it easier to read.