No internet connection
  1. Home
  2. Support

Auto Send Level Adjustment Issue

By Scott Michael Smith @Scott_Smith
    2025-10-28 18:56:49.245Z

    Title

    Auto Send Level Adjustment Issue

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

    Hi, This script opens the top slot in the sends section and adjusts it to -15. If multiple tracks are highlighted it will adjust all. The problem is I believe it goes a bit too fast. It will be good for a bit but then get hung up if a send window doesnt close in time. Possible to add a small delay between each step?

    Are you seeing an error?

    It will run for a bit then get hung up and give this error: 28.10.2025 11:55:32.09 [Backend]: !! Command Error: Send Levels -15 [user:default:clhcyxfns0000ew10ts67kqg3]: Error invoking AXElement: kAXErrorInvalidUIElement (Send Levels -15: Line 30) SoundFlow.Shortcuts.AXUIElementException: kAXErrorInvalidUIElement at SoundFlow.Shortcuts.AXUIElement.DoAction(String action) + 0x98 at SoundFlow.Shortcuts.Automation.Actions.ClickButtonAction.d__11.MoveNext() + 0x7c

    << Command: Send Levels -15 [user:default:clhcyxfns0000ew10ts67kqg3]

    28.10.2025 11:55:34.14 [EditorWindow:Renderer]: Active Focus Container: flow/content Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js
    28.10.2025 11:55:53.18 [Backend]: [SF_FIREBASE_WS]: Sending keep-alive

    What happens when you run this script?

    It will just stop, it will give the error I mentioned in soundflow

    How were you running this script?

    I used a Stream Deck button

    How important is this issue to you?

    4

    Details

    {
        "inputExpected": "Hi, This script opens the top slot in the sends section and adjusts it to -15. If multiple tracks are highlighted it will adjust all. The problem is I believe it goes a bit too fast. It will be good for a bit but then get hung up if a send window doesnt close in time. Possible to add a small delay between each step?\n",
        "inputIsError": true,
        "inputWhatHappens": "It will just stop, it will give the error I mentioned in soundflow ",
        "inputError": "It will run for a bit then get hung up and give this error:   28.10.2025 11:55:32.09  [Backend]: !! Command Error: Send Levels -15 [user:default:clhcyxfns0000ew10ts67kqg3]:\nError invoking AXElement: kAXErrorInvalidUIElement (Send Levels -15: Line 30)\n    SoundFlow.Shortcuts.AXUIElementException: kAXErrorInvalidUIElement\n   at SoundFlow.Shortcuts.AXUIElement.DoAction(String action) + 0x98\n   at SoundFlow.Shortcuts.Automation.Actions.ClickButtonAction.d__11.MoveNext() + 0x7c\n\n<< Command: Send Levels -15 [user:default:clhcyxfns0000ew10ts67kqg3]\n\n28.10.2025 11:55:34.14  [EditorWindow:Renderer]: Active Focus Container:  flow/content Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js\n28.10.2025 11:55:53.18  [Backend]: [SF_FIREBASE_WS]: Sending keep-alive\n\n",
        "inputHowRun": {
            "key": "-MpfwmPg-2Sb-HxHQAff",
            "title": "I used a Stream Deck button"
        },
        "inputImportance": 4,
        "inputTitle": "Auto Send Level Adjustment Issue"
    }

    Source

    const sendA = 0;
    const sendB = 1;
    const sendC = 2;
    const sendD = 3;
    const sendE = 4;
    const sendF = 5;
    const sendG = 6;
    const sendH = 7;
    const sendI = 8;
    const sendJ = 9;
    
    //************************************Pick your favorite send from the above list
    const selectedSend = sendA;
    
    //************************************Set a send level of your choise
    const sendLevel = '-15'
    
    //Maybe ill find a beter way to do this in the future. its a lil crude but it works
    
    const sendVolumeField = sf.ui.proTools.mainTrackOutputWindow.textFields.whoseTitle.is("Volume Numerical").first;
    
    function setSendLevel(trackName){
      //sf.ui.proTools.mainWindow.invalidate();
    
      var currentTrack = sf.ui.proTools.trackGetByName({ name: trackName }).track.sendButtons[selectedSend];
    
      currentTrack.elementClick();
      sf.ui.proTools.mainTrackOutputWindow.elementWaitFor();
      
      sendVolumeField.elementClick();
      sf.keyboard.type({ text: sendLevel });
      sf.keyboard.press({ keys: 'enter' });
    
     // sf.ui.proTools.mainTrackOutputWindow.getElement("AXCloseButton").elementClick();
     // sf.ui.proTools.mainTrackOutputWindow.elementWaitFor({ waitForNoElement: true });
    };
    
    function main(){
       //Scroll first selected track to into view
        sf.ui.proTools.selectedTrack.trackScrollToView();
    
        var trackNames = sf.ui.proTools.selectedTrackNames
        var tracks = sf.ui.proTools.selectedTracks.trackHeaders;
        
        for (var i = 0; i < tracks.length; i++) {
            //var track = tracks[i];
            sf.ui.proTools.trackSelectByName({ names: [trackNames[i]] });
            sf.ui.proTools.selectedTrack.trackScrollToView({});
            setSendLevel(trackNames[i]);
    
        }
    };
    
    main();
    
    
    

    Links

    User UID: lM84xGmQm8e1XXA4OyLUGjN0xDn2

    Feedback Key: sffeedback:lM84xGmQm8e1XXA4OyLUGjN0xDn2:-OcgAWMpeyb5cpySFx6X

    Feedback ZIP: iQIkYyW4bpf/e2cthTrt7C81mZHRhheg4AFROvCLU0V7gcvxVUkPD5cnLIF6tuT24hZz/Y8v17aUQPx9FIHlK4URZvk+qk6ExvPXAmHB/CP+xdqxm7U39VOWo7NlZrSUHBgC33/jNr3VSzg2QT5oQKqgrVOG2qF7KQe3xbSwzs/4eiiYD+PjYw/vn0es7RCLt+6rhlVz+kQbG2RgKBkkFdPAyYJS8eBOihf/hn1FltwRLAXVrLHBNB9CCXzUSDiPJmrKqrAei+vg7YzGf/D6NqIU4WbYszq4Xve48DkpDF0JqLX0QrITp0ut88psxQSUcnPWI7sOZYNFvWYwCCBjMA==

    • 10 replies

    There are 10 replies. Estimated reading time: 13 minutes

    1. Chad Wahlbrink @Chad2025-10-28 20:37:14.488Z2025-10-28 22:55:18.435Z

      Hi, @Scott_Smith,

      Thanks for the question! You could add a wait for the script like this.

      Note that I'm leaving the invalidate() line on Line 24— which could help keep this script running well.

      Then, at line 35, I added a "waitFor()" command that waits for the value to update.

      const sendA = 0;
      const sendB = 1;
      const sendC = 2;
      const sendD = 3;
      const sendE = 4;
      const sendF = 5;
      const sendG = 6;
      const sendH = 7;
      const sendI = 8;
      const sendJ = 9;
      
      //************************************Pick your favorite send from the above list
      const selectedSend = sendA;
      
      //************************************Set a send level of your choise
      const sendLevel = '-15'
      
      const sendVolumeField = sf.ui.proTools.mainTrackOutputWindow.textFields.whoseTitle.is("Volume Numerical").first;
      
      function setSendLevel(trackName) {
          // Open the Send
          sf.ui.proTools.trackGetByName({ name: trackName }).track.sendButtons[selectedSend].elementClick();
      
          // Wait for the send window to show
          sf.ui.proTools.mainTrackOutputWindow.elementWaitFor();
      
          // Set the Send level
          sendVolumeField.elementSetTextFieldWithAreaValue({
              value: sendLevel,
              useMouseKeyboard: true,
          })
      
          sf.keyboard.press({ keys: 'enter' });
      
          // Wait for the value to match
          sf.waitFor({
              callback: () => {
                  sf.ui.proTools.invalidate();
                  return Number(sendVolumeField.value.value) == Number(sendLevel);
              },
              timeout: 2000,
          }, `Failed waiting`);
      
      };
      
      function main() {
          // Activate Pro Tools
          sf.ui.proTools.appActivateMainWindow();
          // Refresh the Cache of UI Elements
          sf.ui.proTools.mainWindow.invalidate();
      
          if(sf.ui.proTools.mainTrackOutputWindow.exists){
              sf.ui.proTools.mainTrackOutputWindow.windowClose();
          }
      
          let trackNames = sf.ui.proTools.selectedTrackNames
          let tracks = sf.ui.proTools.selectedTracks.trackHeaders;
      
          for (let i = 0; i < tracks.length; i++) {
              // Select the Track
              sf.ui.proTools.trackSelectByName({ names: [trackNames[i]] });
      
              // Scroll Track to View
              sf.ui.proTools.selectedTrack.trackScrollToView({});
      
              if (sf.ui.proTools.selectedTrack.sendButtons[0].value.value == 'unassigned') {
                  throw `Send Slot ${selectedSend} is not assigned on this track`
              }
      
              // Set the Send Level
              setSendLevel(trackNames[i]);
          }
      };
      
      main();
      
      1. In reply toScott_Smith:
        Chad Wahlbrink @Chad2025-10-28 21:01:40.169Z2025-10-28 22:45:31.433Z

        I'll also note that you are using SoundFlow 5.10.1, which is a bit older at this point. We just released SoundFlow 6, which is available to download here:

        https://soundflow.org/account/install

        With SoundFlow 6, Pro Tools 2025.10, and SFX, you could take advantage of some improvements with the following script (this may not work if you try to run from your current version of SoundFlow, though).

        We no longer need to use keyboard simulation to enter text values into the send or scroll tracks into view with SoundFlow 6 and Pro Tools 2025.10.

        const sendA = 0;
        const sendB = 1;
        const sendC = 2;
        const sendD = 3;
        const sendE = 4;
        const sendF = 5;
        const sendG = 6;
        const sendH = 7;
        const sendI = 8;
        const sendJ = 9;
        
        //************************************Pick your favorite send from the above list
        const selectedSend = sendA;
        
        //************************************Set a send level of your choise
        const sendLevel = '-15'
        
        const sendVolumeField = sf.ui.proTools.mainTrackOutputWindow.textFields.whoseTitle.is("Volume Numerical").first;
        
        function setSendLevel(trackName) {
            // Open the Send
            sf.ui.proTools.trackGetByName({ name: trackName }).track.sendButtons[selectedSend].elementClick();
            
            // Wait for the send window to show
            sf.ui.proTools.mainTrackOutputWindow.elementWaitFor();
        
            // Set the Send level
            sendVolumeField.elementSetTextFieldWithAreaValue({
                value: sendLevel,
                useMouseKeyboard: true
            })
        
            // Wait for the value to match
            sf.waitFor({
                callback: () => {
                    sf.ui.proTools.mainWindow.invalidate();
                    return sendVolumeField.value.value == sendLevel;
                },
                timeout: 2000,
            }, `Failed waiting`);
        
        };
        
        function main() {
            // Activate Pro Tools
            sf.ui.proTools.appActivateMainWindow();
            // Refresh the Cache of UI Elements
            sf.ui.proTools.mainWindow.invalidate();
        
            let trackNames = sf.ui.proTools.selectedTrackNames
            let tracks = sf.ui.proTools.selectedTracks.trackHeaders;
        
            for (let i = 0; i < tracks.length; i++) {
                // Select the Track
                sf.ui.proTools.trackSelectByName({ names: [trackNames[i]] });
                
                // Scroll Track to View
                sf.ui.proTools.selectedTrack.trackScrollToView({});
        
                if(sf.ui.proTools.selectedTrack.sendButtons[0].value.value == 'unassigned'){
                    throw `Send Slot ${selectedSend} is not assigned on this track`
                }
                
                // Set the Send Level
                setSendLevel(trackNames[i]);
            }
        };
        
        main();
        
        1. S
          In reply toScott_Smith:
          Scott Michael Smith @Scott_Smith
            2025-10-28 21:27:12.544Z

            Thanks Chad! While using either versions of that code I get the following error and the script no longer runs unfortunately. Appreciate any help you can give. thanks!

            28.10.2025 14:25:54.95 [Backend]: !! Command Error: Send -15 Slow [user:default:cmhb146hm0001ox108bzrbyp4]:
            Element was not found or removed after waiting 2000 ms (Send -15 Slow: Line 23)

            << Command: Send -15 Slow [user:default:cmhb146hm0001ox108bzrbyp4]

            28.10.2025 14:25:55.11 [Application]: Updating start menu state with busyMsg: "null"

            1. Chad Wahlbrink @Chad2025-10-28 21:38:06.750Z

              Hi, @Scott_Smith,

              Thanks for the update.

              Can you try updating to either SoundFlow 6.0.1 or SoundFlow 5.10.8, if you do not want to update to SoundFlow 6 just yet and let me know if it's the same result:

              https://soundflow.org/account/downloads

            2. S
              In reply toScott_Smith:
              Scott Michael Smith @Scott_Smith
                2025-10-28 21:41:32.053Z

                Hi Chad,
                Sorry I should have mentioned. Im now running 6.01 and getting the result I sent. Thanks!

                1. Chad Wahlbrink @Chad2025-10-28 22:11:31.814Z

                  Ah, thanks, @Scott_Smith,

                  Can you try copying and pasting the script from this post again:

                  I tweaked it slightly.

                  Note that the second version I shared will only work if you are on Pro Tools 2025.10+ and SoundFlow 6.0.0+. Your logs indicated that you are on Pro Tools 2024.10.2, so using the second version of the script would not work for that setup.

                2. S
                  In reply toScott_Smith:
                  Scott Michael Smith @Scott_Smith
                    2025-10-28 22:26:21.916Z

                    Hi Chad,
                    I just tried the first as Im on PT 2024.10.2. It set the level correctly for one send then timed out with the below error:

                    28.10.2025 15:25:12.86 [Backend]: !! Command Error: Send -15 Slow [user:default:cmhb146hm0001ox108bzrbyp4]:
                    Failed waiting (Send -15 Slow: Line 32)
                    WaitFor timed out after waiting 2000 ms

                    << Command: Send -15 Slow [user:default:cmhb146hm0001ox108bzrbyp4]

                    28.10.2025 15:25:12.86 [Application]: Updating start menu state with busyMsg: "null"
                    28.10.2025 15:25:15.37 [EditorWindow:Renderer]: Active Focus Container: commandsPage/code Line 2 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js

                    1. Chad Wahlbrink @Chad2025-10-28 22:57:00.779Z

                      Hi, @Scott_Smith,

                      Thanks for the testing!! Okay, let's try another version.

                      I refactored this script a bit more. Can you try copying from what I have updated here and running again:

                    2. S
                      In reply toScott_Smith:
                      Scott Michael Smith @Scott_Smith
                        2025-10-28 23:06:24.866Z

                        Much better! Still got hung up midway with the below error: << Command: Send -15 Slow [user:default:cmhb146hm0001ox108bzrbyp4]

                        28.10.2025 16:05:50.51 [Application]: Updating start menu state with busyMsg: "null"
                        28.10.2025 16:05:54.65 [EditorWindow:Renderer]: Active Focus Container: commandsPage/code Line 2 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js
                        28.10.2025 16:05:55.36 [Backend]: [SF_FIREBASE_WS]: Sending keep-alive

                        1. Chad Wahlbrink @Chad2025-10-28 23:31:38.721Z

                          Thanks, @Scott_Smith! Unfortunately, I'm not seeing an error regarding a Line number in that last post.

                          Are you able to take a quick screen recording of the issue occurring and share a Google Drive or Dropbox link here?

                          I wasn't able to get it to fail during testing of that most recent version. I'm curious if it's something with the specific selection of tracks you are working from that I'm not accounting for.