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

Bounce Advanced Script

By Chase A Adams @Chase_A_Adams
    2025-01-11 02:20:25.294Z

    Title

    Bounce Advanced Script

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

    Here are the script instruction:

    • bounce your mix to an interleaved 48k wav file

    • disable all mix-bus processing, then bounce again ( does not turn the FX back on )

    • turn the vocal up +1 dB, then bounce again

    • turn the vocal up another +1 dB, then bounce again

    • restore original vocal gain

    • for each group ( stem ), mute all other groups, then bounce again ( might get called several times )

    • give reasonable names to each bounce

    Are you seeing an error?

    10.01.2025 20:16:28.92 [EditorWindow:Renderer]: Active Focus Container: code Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js

    What happens when you run this script?

    I hit the key bind and it pulls up the bounce menu but then stops and gives me an error code

    How were you running this script?

    I used a keyboard shortcut within the target app

    How important is this issue to you?

    5

    Details

    {
      "inputExpected": "Here are the script instruction: \n\n- bounce your mix to an interleaved 48k wav file\n- disable all mix-bus processing, then bounce again ( does not turn the FX back on )\n- turn the vocal up +1 dB, then bounce again\n- turn the vocal up another +1 dB, then bounce again\n- restore original vocal gain\n- for each group ( stem ), mute all other groups, then bounce again ( might get called several times )\n- give reasonable names to each bounce",
      "inputIsError": true,
      "inputError": "10.01.2025 20:16:28.92 [EditorWindow:Renderer]: Active Focus Container: code Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js",
      "inputWhatHappens": "I hit the key bind and it pulls up the bounce menu but then stops and gives me an error code",
      "inputHowRun": {
          "key": "-Mpfwh4RkPLb2LPwjePT",
          "title": "I used a keyboard shortcut within the target app"
      },
      "inputImportance": 5,
      "inputTitle": "Bounce Advanced Script"
    
    
    

    }

    Source

    if (!sf.ui.proTools.isRunning) throw `Pro Tools is not running`;
    
    // Activate Main Window
    sf.ui.proTools.appActivateMainWindow();
    
    // Invalidate the Main Window - Update the UI Cache for Pro Tools
    sf.ui.proTools.mainWindow.invalidate();
    
    // Bounce Mix Function - Accepts a Name Parameter 
    function bounceMix(bounceName) {
    
        // Click the "Bounce Mix..." Menu Item
        sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce Mix...'] });
    
        // Wait for the "Bounce Mix..." Window to Appear
        sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.elementWaitFor();
    
        // Set the "File Name" Text Field with bounceName parameter
        sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.textFields.first.elementSetTextFieldWithAreaValue({ value: bounceName });
    
        // Set the Sample Rate to "48 kHz"
        if (sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[3].value.value !== '48 kHz') {
            sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[3].popupMenuSelect({ menuPath: ['48 kHz'] });
        }
    
        // Click the "Bounce" Button
        sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.buttons.whoseTitle.is("Bounce").first.elementClick();
    
        // Wait for the "Bounce Mix..." dialog to disappear
        sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.elementWaitFor({
            waitType: "Disappear",
            timeout: -1
        });
    
        // Wait for the "Bouncing" dialog to disappear
        sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Disappear', timeout: -1 });
    
        // Bounce Complete
    }
    
    // 1 - bounce your mix to an interleaved 48k wav file
    
    // Calling the "bounceMix" function
    bounceMix('SongName - Main Mix');
    
    // 2 - disable all mix-bus processing, then bounce again
    
    // Select the Mix Bus track
    sf.ui.proTools.trackSelectByName({ names: ['Mix Bus'] });;
    
    // Toggle Active Status of Inserts on the 'Mix Bus' Track
    sf.ui.proTools.selectedTrack.insertButtons.forEach((insert, i) => {
        if (insert.value.value !== 'unassigned') {
            sf.ui.proTools.selectedTrack.trackInsertToggleActive({ insertNumber: i + 1 })
        }
    })
    
    // Bounce the Mix without Processing
    bounceMix('SongName - Main Mix - No Limiting');
    
    // 3 - turn the vocal up +1 dB, then bounce again
    
    sf.ui.proTools.trackSelectByName({ names: ['LV'] })
    
    //Calling command "Trim Fader +1 dB" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cm5fn5kmt00001d10sopm2o30")
    sf.soundflow.runCommand({
        commandId: 'user:ckp49i4j60000a2100yfwywgf:cklphujq60000u91070dmknxf#cklpi0m6u0008u910f30mzw9g',
        props: {}
    });
    
    bounceMix('SongName - Main Mix - No Limiting - LV+1');
    
    // 4 - turn the vocal up another +1 dB, then bounce again
    
    //Calling command "Trim Fader +1 dB" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cm5fn5kmt00001d10sopm2o30")
    sf.soundflow.runCommand({
        commandId: 'user:ckp49i4j60000a2100yfwywgf:cklphujq60000u91070dmknxf#cklpi0m6u0008u910f30mzw9g',
        props: {}
    });
    
    bounceMix('SongName - Main Mix - No Limiting - LV+2');
    
    // 5 - restore original vocal gain
    
    //Calling command "Trim Fader -2 dB" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cm5fn5kmt00001d10sopm2o30")
    sf.soundflow.runCommand({
        commandId: 'user:ckp49i4j60000a2100yfwywgf:cklphujq60000u91070dmknxf#cklpi0m6u0005u9108wbm19d9',
        props: {}
    });
     
    // 6 - for each group ( stem ), mute all other groups, then bounce again ( might get called several times )
    
    // Select BASS, AGT, and KEYS Bus
    sf.ui.proTools.trackSelectByName({ names: ['BASS', 'AGT', 'KEYS'] });
    
    // Enable Mute for All Selected Tracks
    sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Enable" }));
    
    // Bounce LV Only
    bounceMix('SongName - LV STEM');
    
    // Select BASS and LV Bus
    sf.ui.proTools.trackSelectByName({ names: ['BASS', 'LV'] });
    
    sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Toggle" }));
    
    // Bounce LV Only
    bounceMix('SongName - BASS STEM');
    
    

    Links

    User UID: 2kDpOs8v1oVh2IPFlWO5mlEehsf2

    Feedback Key: sffeedback:2kDpOs8v1oVh2IPFlWO5mlEehsf2:-OGI9P8706dUNxIHX51k

    Feedback ZIP: /1IWPOfkYXmqcJfa0dbo386PCG62aX3A/RDqjiPXipM3hJ4ZhWGDvVkUBuQLjfMzeV1MMO+z0n+kKTb6fLBKQR69w2BpFwvcA4/9hvZIz0seTX7YYF0dyjH+uTecEY0vQLufs39qvWN9Ok7Er0HtYL/7f1DDw2Gy9xTNNGU5v3+Kx1EvF1nORoh2WeYBopkKPPnsLB1f63+dh8sQhmpC+n1hOCSNryK3nD+7luBo/UwO01JC3VFIabEGDKCRW+ectkfkuhHOUkW7Sl4Dw3XfihhmSnGrXaEGXLglj0mMD8DOHpwOoQbR/ngBKjS1vnm1fd6V+Hbli5uPZP6XnshlLxRBAHTS1RsAVa8hZyr2rmc=

    • 9 replies
    1. Chad Wahlbrink @Chad2025-01-11 03:16:16.885Z

      Hi @Chase_A_Adams,

      On the script shared above, the issue you are hitting is an error regarding Line 21 to 23:

       // Set the Sample Rate to "48 kHz"
          if (sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[3].value.value !== '48 kHz') {
              sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[3].popupMenuSelect({ menuPath: ['48 kHz'] });
          }
      

      The error you are getting is:

      !! Command Error: Bounce - Chase Adams [user:default:cm5oka0cl00012t10dph9l8zd]:
      Couldn't get item #3 as the array length was 3 - sf.ui.app('com.avid.ProTools').windows.whoseTitle.is('Bounce Mix').first.groups.whoseTitle.is('Audio').first.popUpButtons[3] (AxElementArrayIndexedItem) (Bounce - Chase Adams: Line 22)
      
      << Command: Bounce - Chase Adams [user:default:cm5oka0cl00012t10dph9l8zd]
      

      This indicates that there may be something different about how your "Bounce Mix" window is laid out. Could you share a screenshot of your "Bounce Mix" window like this?

      1. Chad Wahlbrink @Chad2025-01-11 03:17:20.392Z2025-01-12 00:42:00.874Z

        You can also try this slightly modified version of the script that makes sure the File Type is set to WAV in the Bounce Mix dialog:

        if (!sf.ui.proTools.isRunning) throw `Pro Tools is not running`;
        
        // Activate Main Window
        sf.ui.proTools.appActivateMainWindow();
        
        // Invalidate the Main Window - Update the UI Cache for Pro Tools
        sf.ui.proTools.mainWindow.invalidate();
        
        // Bounce Mix Function - Accepts a Name Parameter 
        function bounceMix(bounceName) {
        
            // Click the "Bounce Mix..." Menu Item
            sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce Mix...'] });
        
            // Wait for the "Bounce Mix..." Window to Appear
            sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.elementWaitFor();
        
            // Set the "File Name" Text Field with bounceName parameter
            sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.textFields.first.elementSetTextFieldWithAreaValue({ value: bounceName });
        
            // Set the File Type to "WAV"
            if (sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.popupButtons.first.value.value !== 'WAV (BWF)') {
                sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.popupButtons.first.popupMenuSelect({menuPath:  ['WAV (BWF)']});
            }
        
            // Set the Sample Rate to "48 kHz"
            if (sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[2].value.value !== '48 kHz') {
                sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[2].popupMenuSelect({ menuPath: ['48 kHz'] });
            }
        
            // Click the "Bounce" Button
            sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.buttons.whoseTitle.is("Bounce").first.elementClick();
        
            // Wait for the "Bounce Mix..." dialog to disappear
            sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.elementWaitFor({
                waitType: "Disappear",
                timeout: -1
            });
        
            // Wait for the "Bouncing" dialog to disappear
            sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Disappear', timeout: -1 });
        
            // Bounce Complete
        }
        
        // 1 - bounce your mix to an interleaved 48k wav file
        
        // Calling the "bounceMix" function
        bounceMix('SongName - Main Mix');
        
        // 2 - disable all mix-bus processing, then bounce again
        
        // Select the Mix Bus track
        sf.ui.proTools.trackSelectByName({ names: ['Mix Bus'] });;
        
        // Toggle Active Status of Inserts on the 'Mix Bus' Track
        sf.ui.proTools.selectedTrack.insertButtons.forEach((insert, i) => {
            if (insert.value.value !== 'unassigned') {
                sf.ui.proTools.selectedTrack.trackInsertToggleActive({ insertNumber: i + 1 })
            }
        })
        
        // Bounce the Mix without Processing
        bounceMix('SongName - Main Mix - No Limiting');
        
        // 3 - turn the vocal up +1 dB, then bounce again
        
        sf.ui.proTools.trackSelectByName({ names: ['ALL LV'] })
        
        //Calling command "Trim Fader +1 dB" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cm5fn5kmt00001d10sopm2o30")
        sf.soundflow.runCommand({
            commandId: 'user:ckp49i4j60000a2100yfwywgf:cklphujq60000u91070dmknxf#cklpi0m6u0008u910f30mzw9g',
            props: {}
        });
        
        bounceMix('SongName - Main Mix - No Limiting - LV+1');
        
        // 4 - turn the vocal up another +1 dB, then bounce again
        
        //Calling command "Trim Fader +1 dB" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cm5fn5kmt00001d10sopm2o30")
        sf.soundflow.runCommand({
            commandId: 'user:ckp49i4j60000a2100yfwywgf:cklphujq60000u91070dmknxf#cklpi0m6u0008u910f30mzw9g',
            props: {}
        });
        
        bounceMix('SongName - Main Mix - No Limiting - LV+2');
        
        // 5 - restore original vocal gain
        
        //Calling command "Trim Fader -2 dB" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cm5fn5kmt00001d10sopm2o30")
        sf.soundflow.runCommand({
            commandId: 'user:ckp49i4j60000a2100yfwywgf:cklphujq60000u91070dmknxf#cklpi0m6u0005u9108wbm19d9',
            props: {}
        });
         
        // 6 - for each group ( stem ), mute all other groups, then bounce again ( might get called several times )
        
        // Select BASS, AGT, and KEYS Bus
        sf.ui.proTools.trackSelectByName({ names: ['BASS', 'AGT', 'KEYS'] });
        
        // Enable Mute for All Selected Tracks
        sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Enable" }));
        
        // Bounce LV Only
        bounceMix('SongName - LV STEM');
        
        // Select BASS and LV Bus
        sf.ui.proTools.trackSelectByName({ names: ['BASS', 'LV'] });
        
        sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Toggle" }));
        
        // Bounce LV Only
        bounceMix('SongName - BASS STEM');
        
        // Etc. 
        
        1. Chase A Adams @Chase_A_Adams
            2025-01-11 16:33:48.313Z

            Thanks, Chad. It appears I'm getting the same error code despite using the new script you sent and making sure the bounce is set to WAV. Here's the error code I'm now getting:

            11.01.2025 10:32:43.95 [EditorWindow:Renderer]: Active Focus Container: code Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js

          • In reply toChad:
            Chase A Adams @Chase_A_Adams
              2025-01-11 16:31:23.867Z
              1. Chad Wahlbrink @Chad2025-01-12 00:49:37.462Z

                Okay, thanks, @Chase_A_Adams.

                So let's try changing the "set to 48kHz" section to this:

                    // Set the Sample Rate to "48 kHz"
                    if (sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[2].value.value !== '48 kHz') {
                        sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[2].popupMenuSelect({ menuPath: ['48 kHz'] });
                    }
                

                Your bounce mix window's "Audio" section has 3 dropdowns instead of 4 (mine has a "compression type" drop-down shown here).

                So the sample rate dropdown for you is the 3rd element - in 0-based arrays of elements, that means it's addressed as allItems[2].

                What version of Pro Tools are you running? I'm unsure if that difference in the bounce mix window is something on Pro Tools Artist or Pro Tools Studio vs Pro Tools Ultimate.

                I changed the full script on this post, so let me know if that works better:
                Bounce Advanced Script #post-3

                1. Chase A Adams @Chase_A_Adams
                    2025-01-12 03:16:48.480Z

                    Thanks Chad! I'm using Pro Tools Artist currently. Maybe that's the difference. Okay- the script is working now. It seems to stop after disabling mix bus processing, so I just need to add code to finish the rest of the instructions it seems. And it's only bouncing lead vocals right now, correct?

                    1. Chad Wahlbrink @Chad2025-01-12 18:19:21.967Z

                      Hi, @Chase_A_Adams,

                      Yes, scripting for Pro Tools Artist does seem to require some tweaking. I apologize for not clarifying the version you were using earlier!

                      The script below should be a bit more stable with Pro Tools Artist.

                      Here's a simple test session that should work with it as well:
                      https://www.dropbox.com/scl/fi/ldw4j46k37q4ok2ty1c6a/SIMPLE-STEMS-PT-ARTIST.zip?rlkey=rrss0ky3rufwqh80cmibg7318&dl=0

                      This should give you the following output stems:

                      Note that if track names are changed or more or fewer tracks are involved, this script would need to be tailored. This is just a barebones version of a bounce script but it should satisfy the conditions you laid out.

                      if (!sf.ui.proTools.isRunning) throw `Pro Tools is not running`;
                      
                      // Activate Main Window
                      sf.ui.proTools.appActivateMainWindow();
                      
                      // Invalidate the Main Window - Update the UI Cache for Pro Tools
                      sf.ui.proTools.mainWindow.invalidate();
                      
                      // Bounce Mix Function - Accepts a Name Parameter 
                      function bounceMix(bounceName) {
                      
                          // Click the "Bounce Mix..." Menu Item
                          sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce Mix...'] });
                      
                          // Wait for the "Bounce Mix..." Window to Appear
                          sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.elementWaitFor();
                      
                          // Set the "File Name" Text Field with bounceName parameter
                          sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.textFields.first.elementSetTextFieldWithAreaValue({ value: bounceName });
                      
                          // Set the File Type to "WAV"
                          if (sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.popupButtons.first.value.value !== 'WAV (BWF)') {
                              sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.popupButtons.first.popupMenuSelect({ menuPath: ['WAV (BWF)'] });
                          }
                      
                          // Set the Sample Rate to "48 kHz"
                          if (sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[2].value.value !== '48 kHz') {
                              sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.groups.whoseTitle.is("Audio").first.popupButtons.allItems[2].popupMenuSelect({ menuPath: ['48 kHz'] });
                          }
                      
                          // Click the "Bounce" Button
                          sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.buttons.whoseTitle.is("Bounce").first.elementClick();
                      
                          const dlg = sf.ui.proTools.confirmationDialog;
                          //Wait 100ms for dialog box to appear
                          dlg.elementWaitFor({
                              timeout: 100,
                              pollingInterval: 10,
                              onError: "Continue",
                          });
                      
                          // Replace the file if it already exists. 
                          if (dlg.children.whoseRole.is("AXStaticText").whoseValue.contains('Do You Want to Replace It?').first.exists) {
                      
                              dlg.buttons.whoseTitle.is('Yes').first.elementClick();
                      
                              dlg.elementWaitFor({
                                  waitType: "Disappear",
                                  timeout: 100,
                                  pollingInterval: 10,
                                  onError: "Continue",
                              });
                      
                          }
                      
                          // Wait for the "Bounce Mix..." dialog to disappear
                          sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.elementWaitFor({
                              waitType: "Disappear",
                              timeout: -1
                          });
                      
                          // Wait for the "Bouncing" dialog to disappear
                          sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Disappear', timeout: -1 });
                      
                          // Bounce Complete
                      }
                      
                      // Select and Disable Mute on the 'BASS', 'AGT', 'KEYS', 'VOCALS' bus
                      sf.ui.proTools.trackSelectByName({ names: ['BASS', 'AGT', 'KEYS', 'VOCALS'] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Disable" }));
                      
                      // 1 - bounce your mix to an interleaved 48k wav file
                      
                      // Calling the "bounceMix" function
                      bounceMix('SongName - Main Mix');
                      
                      // 2 - disable all mix-bus processing, then bounce again
                      
                      // Select the Mix Bus track
                      sf.ui.proTools.trackSelectByName({ names: ['MIX BUS'] });;
                      
                      // Toggle Active Status of Inserts on the 'Mix Bus' Track
                      sf.ui.proTools.selectedTrack.insertButtons.forEach((insert, i) => {
                          if (insert.value.value !== 'unassigned') {
                              sf.ui.proTools.selectedTrack.trackInsertToggleActive({ insertNumber: i + 1 })
                          }
                      })
                      
                      // Bounce the Mix without Processing
                      bounceMix('SongName - Main Mix - No Limiting');
                      
                      // 3 - turn the vocal up +1 dB, then bounce again
                      
                      sf.ui.proTools.trackSelectByName({ names: ['VOCALS'] })
                      
                      //Calling command "Trim Fader +1 dB" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cm5fn5kmt00001d10sopm2o30")
                      sf.soundflow.runCommand({
                          commandId: 'user:ckp49i4j60000a2100yfwywgf:cklphujq60000u91070dmknxf#cklpi0m6u0008u910f30mzw9g',
                          props: {}
                      });
                      
                      bounceMix('SongName - Main Mix - No Limiting - LV+1');
                      
                      // 4 - turn the vocal up another +1 dB, then bounce again
                      
                      //Calling command "Trim Fader +1 dB" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cm5fn5kmt00001d10sopm2o30")
                      sf.soundflow.runCommand({
                          commandId: 'user:ckp49i4j60000a2100yfwywgf:cklphujq60000u91070dmknxf#cklpi0m6u0008u910f30mzw9g',
                          props: {}
                      });
                      
                      bounceMix('SongName - Main Mix - No Limiting - LV+2');
                      
                      // 5 - restore original vocal gain
                      
                      //Calling command "Trim Fader -2 dB" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cm5fn5kmt00001d10sopm2o30")
                      sf.soundflow.runCommand({
                          commandId: 'user:ckp49i4j60000a2100yfwywgf:cklphujq60000u91070dmknxf#cklpi0m6u0005u9108wbm19d9',
                          props: {}
                      });
                      
                      // 6 - for each group ( stem ), mute all other groups, then bounce again ( might get called several times )
                      
                      // Select and Enable Mute on 'BASS', 'AGT', 'KEYS' Bus
                      sf.ui.proTools.trackSelectByName({ names: ['BASS', 'AGT', 'KEYS'] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Enable" }));
                      
                      // Select and Disable Mute on the VOCOALS track
                      sf.ui.proTools.trackSelectByName({ names: ['VOCALS'] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Disable" }));
                      
                      // Bounce VOCALS STEM
                      bounceMix('SongName - LV STEM');
                      
                      // Select and Enable Mute on the 'AGT','KEYS', 'VOCALS' bus
                      sf.ui.proTools.trackSelectByName({ names: ['AGT', 'KEYS', 'VOCALS'] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Enable" }));
                      
                      // Select and Disable Mute on the BASS bus
                      sf.ui.proTools.trackSelectByName({ names: ['BASS',] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Disable" }));
                      
                      // Bounce BASS STEM
                      bounceMix('SongName - BASS STEM');
                      
                      // Select and Enable Mute on the 'BASS', 'KEYS', 'VOCALS' bus
                      sf.ui.proTools.trackSelectByName({ names: ['BASS', 'KEYS', 'VOCALS'] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Enable" }));
                      
                      // Select and Disable Mute on the AGT bus
                      sf.ui.proTools.trackSelectByName({ names: ['AGT',] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Disable" }));
                      
                      // Bounce Acoustic Guitar STEM
                      bounceMix('SongName - AGT STEM');
                      
                      // Select and Enable Mute on the 'BASS', 'AGT', 'VOCALS' bus
                      sf.ui.proTools.trackSelectByName({ names: ['BASS', 'AGT', 'VOCALS'] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Enable" }));
                      
                      // Select and Disable Mute on the 'KEYS' bus
                      sf.ui.proTools.trackSelectByName({ names: ['KEYS',] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Disable" }));
                      
                      // Bounce KEYS STEM
                      bounceMix('SongName - KEYS STEM');
                      
                      // Select and Disable Mute on the 'BASS', 'AGT', 'KEYS', 'VOCALS' bus
                      sf.ui.proTools.trackSelectByName({ names: ['BASS', 'AGT', 'KEYS', 'VOCALS'] });
                      sf.ui.proTools.selectedTracks.trackHeaders.map(x => x.trackSetMute({ targetValue: "Disable" }));
                      
                      1. Chase A Adams @Chase_A_Adams
                          2025-01-12 19:48:03.609Z

                          This script blows my mind... phenomenal job Chad. You are a genius.
                          Thank you all for the help on this, and thank you Chad for getting this code to work as the instructions asked. You're a wizard, Chad!!

                          Blessings,
                          Chase Adams

                          1. Chad Wahlbrink @Chad2025-01-13 19:49:48.543Z

                            Glad we got it working!

                            Have a great week, @Chase_A_Adams