No internet connection
  1. Home
  2. How to

How to commit tracks (and more)

By Paul Fraser @Paul_Fraser
    2021-06-07 15:49:47.002Z

    How do I find script for making a track "commit" and to "quantize midi" in Pro Tools?

    • 17 replies

    There are 17 replies. Estimated reading time: 13 minutes

    1. Hi Paul,

      If these are available as menu items, you should be able to create a macro for this, then add the Click Menu Item action :)

      1. M
        In reply toPaul_Fraser:
        Martin Pavey @Martin_Pavey
          2021-06-23 15:15:02.956Z

          Here's a simple script to commit a selection.
          I hope it helps.

          sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({
              menuPath: ['Commit...'],
              isRightClick: true,
          });
          sf.wait(1500);
          
          sf.ui.proTools.windows.whoseTitle.is('Commit Tracks').first.popupButtons.whoseTitle.is('Selected Tracks').first.popupMenuOpenFromElement({
              executionMode: "Background",
          });
          sf.keyboard.press({
              keys: "down, return",
              executionMode: "Background",
          });
          var dlg = sf.ui.proTools.windows.whoseTitle.is('Commit Tracks').first.elementWaitFor().element;
          dlg.buttons.whoseTitle.is('OK').first.elementClick();
          dlg.elementWaitFor({ waitForNoElement: true });
          
          1. PPhilip weinrobe @Philip_weinrobe
              2021-09-22 19:13:50.463Z

              is it possible to expose some more of the commit dialog window in this script so i can edit it to make different versions of commit (sometimes i want to hide and make inactive, sometimes i want do nothing, etc etc)

              would be great just to get the above parameter exposed in the script so we can edit. thank you!!

              1. Chris Shaw @Chris_Shaw2021-09-22 20:48:18.139Z2021-09-22 21:48:27.693Z

                try this (or the script below this):

                sf.ui.proTools.appActivate();
                
                // Declare action to take after commiting (Change to desired action)
                 var afterCommit = "Hide and Make Inactive"
                
                 //Open and wait for commit dialog window
                sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({
                    menuPath: ['Commit...'],
                    isRightClick: true,
                });
                
                // Define commit window element
                var commitWin = sf.ui.proTools.windows.whoseTitle.is('Commit Tracks').first
                
                commitWin.elementWaitFor().element;
                
                // Commit Select "Selected Tracks"
                commitWin.popupButtons.whoseDescription.is("").first.popupMenuSelect({
                    menuPath: ["Selected Tracks"],
                });
                
                // Set after commit action
                commitWin.popupButtons.whoseDescription.is("").allItems[1].popupMenuSelect({
                    menuPath: [afterCommit],
                });
                        
                // Commit Tracks
                commitWin.buttons.whoseTitle.is('OK').first.elementClick();
                
                1. Chris Shaw @Chris_Shaw2021-09-22 21:42:24.464Z2021-09-22 22:58:44.152Z

                  Here's a version that will let you set all options in the Commit window and works with multiple tracks:

                  // Declare commit window options (Change as needed)
                  
                  var commitCheckBoxes = {
                      "Consolidate Clips": "Enable",
                  
                      // Render Automation:
                      "Volume and Mute": "Disable",
                      "Pan": "Disable",
                  
                      // Copy:
                      "Sends": "Enable",
                      "Group Assignments": "Enable",
                  
                      "Insert after last selected track": "Enable",
                      "Offline": "Enable",
                  };
                  
                  // Declare commit window drop down menus (Change as needed)
                  var commitPopupMenus = {
                      Commit: "Selected Tracks",
                      SourceTracks: "Hide and Make Inactive"
                  };
                  
                  function commitTrack(commitCheckBoxes, commitPopupMenus) {
                  
                      //Open Commit Dialog window
                      sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({
                          menuPath: ['Commit...'],
                          isRightClick: true,
                      });
                  
                      var commitWin = sf.ui.proTools.windows.whoseTitle.is('Commit Tracks').first
                  
                      commitWin.elementWaitFor().element;
                  
                      // Set checkBoxes
                      for (var cbItem in commitCheckBoxes) {
                          commitWin.checkBoxes.whoseTitle.is(cbItem).first.checkboxSet({
                              targetValue: commitCheckBoxes[cbItem]
                          });
                      };
                  
                      // Set Commit Menu
                      commitWin.popupButtons.whoseDescription.is("").first.popupMenuSelect({
                          menuPath: [commitPopupMenus.Commit],
                      });
                  
                      // Set Source Tracks action
                      commitWin.popupButtons.whoseDescription.is("").allItems[1].popupMenuSelect({
                          menuPath: [commitPopupMenus.SourceTracks],
                      });
                  
                      // Commit Tracks
                      commitWin.buttons.whoseTitle.is('OK').first.elementClick();
                  
                      sf.ui.proTools.waitForNoModals();
                  };
                  
                  // Main
                  sf.ui.proTools.appActivate();
                  sf.ui.proTools.mainWindow.invalidate();
                  
                  // Get selected track names / check that tracks are selected
                  const origSelectedTracks = sf.ui.proTools.selectedTrackNames
                  if (origSelectedTracks.length == 0) {
                      sf.interaction.notify({
                          title: "Commit Tracks",
                          message: "No tracks selected"
                      });
                      throw 0;
                  };
                  
                  // Commit selected tracks
                  origSelectedTracks.forEach(track => {
                      sf.ui.proTools.trackSelectByName({ names: [track] });
                      sf.ui.proTools.selectedTrack.trackScrollToView();
                      commitTrack(commitCheckBoxes, commitPopupMenus);
                      sf.ui.proTools.mainWindow.invalidate();
                  });
                  
                  // Re-select original selected tracks
                  sf.ui.proTools.trackSelectByName({ names: origSelectedTracks });
                  
                  1. PPhilip weinrobe @Philip_weinrobe
                      2021-09-24 18:11:25.312Z

                      thanks chris!

                      1. PPhilip weinrobe @Philip_weinrobe
                          2021-09-24 20:35:21.308Z

                          seems this cycles through the tracks. can it instead keep tracks selected when bringing up the commit dialog and then hitting ok? if it keeps tracks selected then all will be done at the same time.

                        • In reply toChris_Shaw:
                          PPhilip weinrobe @Philip_weinrobe
                            2021-09-24 22:43:14.184Z

                            actually, the earlier simpler script you posted is excatly what i need and working perfectly. all set! thanks chris

                            1. In reply toChris_Shaw:
                              PPhilip weinrobe @Philip_weinrobe
                                2024-01-29 16:00:30.862Z

                                Hey Chris,
                                Do you think you could help me tweak this just a bit?
                                Below is my code that works perfect for setting a few variables than committing multiple tracks at once. However, i would like to expose and be able to edit all variables, like your above code.
                                Could you help show me how to bring all those variables into my script? I tried..but failed.

                                //https://forum.soundflow.org/-5020/how-to-commit-tracks-and-more// 
                                // fucking around//
                                sf.ui.proTools.appActivate();
                                
                                // Declare action to take after commiting (Change to desired action)
                                 var afterCommit = "Do Nothing"
                                
                                 //Open and wait for commit dialog window
                                sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({
                                    menuPath: ['Commit...'],
                                    isRightClick: true,
                                });
                                
                                // Define commit window element
                                var commitWin = sf.ui.proTools.windows.whoseTitle.is('Commit Tracks').first
                                
                                commitWin.elementWaitFor().element;
                                
                                // Commit Select "Selected Tracks"
                                commitWin.popupButtons.whoseDescription.is("").first.popupMenuSelect({
                                    menuPath: ["Edit Selection"],
                                });
                                
                                // Set after commit action
                                commitWin.popupButtons.whoseDescription.is("").allItems[1].popupMenuSelect({
                                    menuPath: [afterCommit],
                                });
                                        
                                // Commit Tracks
                                commitWin.buttons.whoseTitle.is('OK').first.elementClick();
                                
                                1. //https://forum.soundflow.org/-5020/how-to-commit-tracks-and-more// 
                                  // fucking around//
                                  sf.ui.proTools.appActivate();
                                  
                                  // Declare commit window options (Change as needed)
                                  var commitCheckBoxes = {
                                      "Consolidate Clips": "Enable",
                                  
                                      // Render Automation:
                                      "Volume and Mute": "Disable",
                                      "Pan": "Disable",
                                  
                                      // Copy:
                                      "Sends": "Enable",
                                      "Group Assignments": "Enable",
                                  
                                      "Insert after last selected track": "Enable",
                                      "Offline": "Enable",
                                  };
                                  
                                  // Declare commit window drop down menus (Change as needed)
                                  var commitPopupMenus = {
                                      Commit: "Selected Tracks",
                                      SourceTracks: "Hide and Make Inactive"
                                  };
                                  
                                  function commitTracks(commitCheckBoxes, commitPopupMenus) {
                                  
                                      //Open Commit Dialog window
                                      sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({
                                          menuPath: ['Commit...'],
                                          isRightClick: true,
                                      });
                                      var commitWin = sf.ui.proTools.windows.whoseTitle.is('Commit Tracks').first
                                  
                                      commitWin.elementWaitFor().element;
                                  
                                      // Set checkBoxes
                                      for (var cbItem in commitCheckBoxes) {
                                          commitWin.checkBoxes.whoseTitle.is(cbItem).first.checkboxSet({
                                              targetValue: commitCheckBoxes[cbItem]
                                          });
                                      };
                                  
                                      // Set Commit Menu
                                      commitWin.popupButtons.whoseDescription.is("").first.popupMenuSelect({
                                          menuPath: [commitPopupMenus.Commit],
                                      });
                                  
                                      // Set Source Tracks action
                                      commitWin.popupButtons.whoseDescription.is("").allItems[1].popupMenuSelect({
                                          menuPath: [commitPopupMenus.SourceTracks],
                                      });
                                  
                                      // Commit Tracks
                                      commitWin.buttons.whoseTitle.is('OK').first.elementClick();
                                  
                                      sf.ui.proTools.waitForNoModals();
                                  };
                                  
                                  ////////
                                  //MAIN//
                                  ////////
                                  
                                  commitTracks(commitCheckBoxes, commitPopupMenus);
                                  
                                  
                                  
                                  1. PPhilip weinrobe @Philip_weinrobe
                                      2024-01-29 16:47:05.590Z

                                      thanks chris!
                                      the pop-up menus don't seem to work..."edit selction" and the "do nothing/make inactive" parts.
                                      everything else seems to be reading correctly...

                                      1. PPhilip weinrobe @Philip_weinrobe
                                          2024-01-29 16:48:11.383Z

                                          weird cause i see it try to change that first pop up, but it doesn't seem to fully do it...

                                          1. PPhilip weinrobe @Philip_weinrobe
                                              2024-01-29 16:49:34.515Z

                                              here is error:

                                              29.01.2024 11:48:59.61 [Backend]: !! Command Error: COMMIT TEST ALL VARIABLES [user:default:clrz4250a00047q10wsla4ry4]:
                                              Could not open popup menu (COMMIT TEST ALL VARIABLES: Line 51)
                                              Popup menu was not found
                                              Popup window was not found after waiting 2000 ms

                                              1. Have you changed the settings? (ie lines 23 and 24) to the desired settings? Are they spelled correctly? All variation of the setting work on my setup (2023.12 / Ventura)

                                                1. Edit selection wont work (menu greyed out) unless a selection is made.

                                                  1. In reply toChris_Shaw:
                                                    PPhilip weinrobe @Philip_weinrobe
                                                      2024-01-29 17:40:08.888Z

                                                      yeah, def spelled correctly.
                                                      i am running 2023.9/Ventura bc there were some other soundflow issues in 2023.12...but maybe it's time to step up and deal with them.

                                                      will report back from 2023.12

                                    • In reply toMartin_Pavey:
                                      PPhilip weinrobe @Philip_weinrobe
                                        2021-09-22 19:14:32.413Z

                                        this script is amazing, by the way. saving me a TON of time and really allowing me to get creative with outboard performances now that it's sooo easy to capture them with one click