No internet connection
  1. Home
  2. How to

How to change options in Preferences

By Sean @SeanH
    2018-06-20 08:40:42.407Z

    This one may not be possible, but there are certain Eucon commands that you can assign to soft keys that can be helpful to have immediate access to while mixing, that otherwise are only accessible by opening Preferences and clicking checkboxes. Would be awesome if SF could access these.

    the specific ones that come to mind are:

    — Allow Latch Prime in Stop

    —Include Sends in Trim Mode

    — Coalesce Trim Automation options

    — Track metering settings

    Solved in post #5, click to view
    • 19 replies

    There are 19 replies. Estimated reading time: 22 minutes

    1. Great request, @SeanH.
      As has already been discussed elsewhere, we cannot at the moment support the Eucon protocol since it would probably involve reverse engineering or getting licensed by Avid (and since that would compete with their consoles I don't see that happening).
      However, we could automate opening the Prefs dialog and click checkboxes. Usually the GUI automation is pretty quick so it would may be barely noticeable - and I guess lots of functions could benefit from being able to set prefs.
      Would that kind of solution be usable to you?

      1. SSean @SeanH
          2018-06-20 15:12:20.743Z

          yes, that's what I was thinking!

          I dont really have to access these all that often, so a simple macro that would open the prefs, select the tabs, check the boxes, and close, would be perfectly acceptable and still save some time over doing it by hand.

          the main one that I think would be useful is "include sends in trim mode"

          1. In reply toSeanH:
            SSean @SeanH
              2018-06-20 15:28:03.949Z

              totally understand about eucon btw, I wouldn't ever expect SF to be actually be able to access eucon directly, I just am using eucon commands as a brainstorming example of things SF could maybe find other more creative ways to access and accomplish the same task.

              its quite impressive that SF almost can access pretty much all the same commands as eucon already! who needs them anyhow. Eucon was buggy as hell for a LONG time not even in beta. Sf already works better then eucon did for the first 10 years of its existence

              1. Thank you for the compliment :)
                And great with your effort to find other things we could automate based on EuCon! Keep it coming ;)

          2. In reply toSeanH:

            This would be a way to do it with the current scripting actions:

            
            //Open up Preferences
            sf.ui.proTools.menuClick({ menuPath: ['Pro Tools', 'Preferences...'] });
            
            //Wait for Preferences window to appear
            var prefsWin = sf.ui.proTools.dialogWaitForManual({ dialogTitle: 'Pro Tools | Ultimate Preferences' }).dialog;
            
            //Choose tab 'Mixing'
            prefsWin.getFirstWithTitleContaining("Mixing").elementClick();
            
            //Find the 'Automation' group
            var automationGroup = prefsWin.getFirstWithTitle("Automation");
            
            //Find the 'Include Sends in Trim Mode' checkbox
            var includeSendsInTrimMode = automationGroup.getFirstWithTitle("Include Sends in Trim Mode");
            
            //Instruct SF to either toggle, disable or enable the checkbox
            includeSendsInTrimMode.checkboxSet({
                targetValue: 'Toggle' //or 'Enable' or 'Disable'
            });
            
            //Click 'OK' button
            prefsWin.getFirstWithTitle("OK").elementClick();
            
            Reply1 LikeSolution
            1. Here is a version that is easy to adapt to different checkboxes:

              const tabName = "Mixing";
              const groupName = "Automation";
              const checkboxName = "Include Sends in Trim Mode";
              const targetValue = "Toggle"; //or 'Enable' or 'Disable'
              const prefsTitle = 'Pro Tools | Ultimate Preferences';
              
              
              //Open up Preferences
              sf.ui.proTools.menuClick({ menuPath: ['Pro Tools', 'Preferences...'] });
              
              //Wait for Preferences window to appear
              var prefsWin = sf.ui.proTools.dialogWaitForManual({ dialogTitle: prefsTitle }).dialog;
              
              //Choose tab
              prefsWin.getFirstWithTitleContaining(tabName).elementClick();
              
              //Find the group
              var group = prefsWin.getFirstWithTitle(groupName);
              
              //Find the checkbox
              var checkbox = group.getFirstWithTitle(checkboxName);
              
              //Instruct SF to either toggle, disable or enable the checkbox
              checkbox.checkboxSet({
                  targetValue: targetValue
              });
              
              //Click 'OK' button
              prefsWin.getFirstWithTitle("OK").elementClick();
              
              1. Stefan Möhl @Stefan_Mohl
                  2019-09-26 15:43:13.161Z

                  I jump to this thread because I am trying to switch between tabs in the same script.
                  At the moment I have two scripts for each tab which I want to combine.
                  1st script:

                  
                  const prefsTitle = 'Pro Tools | Ultimate Preferences';
                  const tabName = "Display";
                  const groupName = "Color Coding";
                  const checkboxName = "Always Display Marker Colors";
                  const targetValue = "Enable"; //or 'Enable' or 'Disable'
                  
                  
                  
                  //Open up Preferences
                  sf.ui.proTools.menuClick({ menuPath: ['Pro Tools', 'Preferences...'] });
                  
                  //Wait for Preferences window to appear
                  var prefsWin = sf.ui.proTools.dialogWaitForManual({ dialogTitle: prefsTitle }).dialog;
                  
                  
                  //Choose tab
                  prefsWin.getFirstWithTitleContaining(tabName).elementClick();
                  
                  sf.ui.proTools.windows.whoseTitle.is('Pro Tools | Ultimate Preferences').first.groups.whoseTitle.is('Color Coding').first.radioButtons.whoseTitle.is('Track Color').first.elementClick();
                  
                  //Find the group
                  var group = prefsWin.getFirstWithTitle(groupName);
                  
                  //Find the checkbox
                  var checkbox = group.getFirstWithTitle(checkboxName);
                  
                  //Instruct SF to either toggle, disable or enable the checkbox
                  checkbox.checkboxSet({
                      targetValue: targetValue
                  });
                  
                  
                  //Click 'OK' button
                  prefsWin.getFirstWithTitle("OK").elementClick();
                  

                  In the script it we be graet first to check if the checkbox is already checked. How can I put thi into an if statement.
                  Because I got an error message if it is already enabled.

                  The 2nd script sets a radio Button is the Operation tab.
                  Here I want to make sure that in the Transport section the Numeric Keypad the radioButton is set to Transport.
                  I have done this via the macro and then copy the action to a script.

                  
                  const prefsTitle = 'Pro Tools | Ultimate Preferences';
                  const tabName = "Operation";
                  const groupName = "Transport";
                  const radioButtonName = "Transport";
                  
                  
                  //Open up Preferences
                  sf.ui.proTools.menuClick({ menuPath: ['Pro Tools', 'Preferences...'] });
                  
                  //Wait for Preferences window to appear
                  var prefsWin = sf.ui.proTools.dialogWaitForManual({ dialogTitle: prefsTitle }).dialog;
                  
                  //////////
                  
                  //Choose tab
                  prefsWin.getFirstWithTitleContaining(tabName).elementClick();
                  
                  //Find the group
                  var group = prefsWin.getFirstWithTitle(groupName);
                  
                  
                  
                  sf.ui.proTools.windows.whoseTitle.is('Pro Tools | Ultimate Preferences').first.groups.whoseTitle.is('Transport').first.groups.whoseTitle.is('Numeric Keypad Mode').first.radioButtons.whoseTitle.is('Transport').first.elementClick();
                  
                  
                  //Click 'OK' button
                  prefsWin.getFirstWithTitle("OK").elementClick();
                  

                  It would be nice to find a way to switch between the tabs in the same script.
                  Can I overwrite the const variables in javascript?

                  1. Hi @Stefan_Mohl

                    Glad you ask - maybe time to update this old piece of code.

                    Here you have a script which supports setting more than one preference at a time, and that supports both checkboxes and radiobuttons (you configure it in the bottom):

                    
                    function openPrefs() {
                        sf.ui.proTools.appActivateMainWindow();
                    
                        //Open up Preferences
                        sf.ui.proTools.menuClick({ menuPath: ['Pro Tools', 'Preferences...'] });
                    
                        //Wait for Preferences window to appear
                        var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                        prefsWin.elementWaitFor();
                    }
                    
                    function setPrefCheckbox(tabName, groupName, checkboxName, targetValue) {
                        var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                    
                        //Choose tab
                        prefsWin.children.whoseTitle.startsWith(tabName).first.elementClick();
                    
                        //Find group
                        var group = prefsWin.groups.whoseTitle.is(groupName).first;
                    
                        //Find CheckBox and set it
                        var checkbox = group.checkBoxes.whoseTitle.is(checkboxName).first;
                        checkbox.checkboxSet({
                            targetValue: targetValue
                        });
                    }
                    
                    function setPrefRadioButton(tabName, groupName, radioButtonName) {
                        var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                    
                        //Choose tab
                        prefsWin.children.whoseTitle.startsWith(tabName).first.elementClick();
                    
                        //Find group
                        var group = prefsWin.groups.whoseTitle.is(groupName).first;
                    
                        //Find RadioButton and click it
                        group.radioButtons.whoseTitle.is(radioButtonName).first.elementClick();
                    }
                    
                    function closePrefs() {
                        //Click OK
                        var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                        prefsWin.buttons.whoseTitle.is("OK").first.elementClick();
                    
                        //Wait for Preferences window to close
                        prefsWin.elementWaitFor({ waitForNoElement: true });
                    }
                    
                    //Here you set your preferences:
                    openPrefs();
                    setPrefCheckbox('Display', 'Color Coding', 'Always Display Marker Colors', 'Enable');
                    setPrefRadioButton('Display', 'Color Coding', 'Track Type');
                    closePrefs();
                    
                    1. Stefan Möhl @Stefan_Mohl
                        2019-09-26 16:14:55.840Z

                        Thank you Christian,

                        this looks very nice.
                        I try to switch to another tab but I get an error after changing to the Operation tab

                        setPrefRadioButton('Display', 'Color Coding', 'Track Color');
                        setPrefRadioButton('Operation', 'Transport', 'Transport');
                        
                        1. You need a separate function for these types of RadioButtons (they're more deeply nested):

                          
                          function openPrefs() {
                              sf.ui.proTools.appActivateMainWindow();
                          
                              //Open up Preferences
                              sf.ui.proTools.menuClick({ menuPath: ['Pro Tools', 'Preferences...'] });
                          
                              //Wait for Preferences window to appear
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                              prefsWin.elementWaitFor();
                          }
                          
                          function setPrefCheckbox(tabName, groupName, checkboxName, targetValue) {
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                          
                              //Choose tab
                              prefsWin.children.whoseTitle.startsWith(tabName).first.elementClick();
                          
                              //Find group
                              var group = prefsWin.groups.whoseTitle.is(groupName).first;
                          
                              //Find CheckBox and set it
                              var checkbox = group.checkBoxes.whoseTitle.is(checkboxName).first;
                              checkbox.checkboxSet({
                                  targetValue: targetValue
                              });
                          }
                          
                          function setPrefRadioButton(tabName, groupName, radioButtonName) {
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                          
                              //Choose tab
                              prefsWin.children.whoseTitle.startsWith(tabName).first.elementClick();
                          
                              //Find group
                              var group = prefsWin.groups.whoseTitle.is(groupName).first;
                          
                              //Find RadioButton and click it
                              group.radioButtons.whoseTitle.is(radioButtonName).first.elementClick();
                          }
                          
                          function setPrefRadioButton2(tabName, groupName, groupName2, radioButtonName) {
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                          
                              //Choose tab
                              prefsWin.children.whoseTitle.startsWith(tabName).first.elementClick();
                          
                              //Find group
                              var group = prefsWin.groups.whoseTitle.is(groupName).first;
                              var group2 = group.groups.whoseTitle.is(groupName2).first;
                          
                              //Find RadioButton and click it
                              group2.radioButtons.whoseTitle.is(radioButtonName).first.elementClick();
                          }
                          
                          function closePrefs() {
                              //Click OK
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                              prefsWin.buttons.whoseTitle.is("OK").first.elementClick();
                          
                              //Wait for Preferences window to close
                              prefsWin.elementWaitFor({ waitForNoElement: true });
                          }
                          
                          //Here you set your preferences:
                          openPrefs();
                          setPrefCheckbox('Display', 'Color Coding', 'Always Display Marker Colors', 'Enable');
                          setPrefRadioButton('Display', 'Color Coding', 'Track Color');
                          setPrefRadioButton2('Operation', 'Transport', 'Numeric Keypad Mode', 'Transport');
                          closePrefs();
                          
                          1. Stefan Möhl @Stefan_Mohl
                              2019-09-27 07:27:05.901Z

                              thank you Christian. That works smooth.

                  2. In reply toSeanH:
                    Dustin Harris @Dustin_Harris
                      2019-10-05 00:29:26.077Z2019-10-05 10:18:36.945Z

                      I'm trying to adapt the function to toggle the Audio Files checkbox in the 'Save Copy In...' window in pr tools but I'm also getting the error "CheckBoxAction requires UIElement (Checkbox Action)"

                      Any chance you can see where I'm going wrong?

                      function setPrefCheckbox(groupName, checkboxName, targetValue) {
                          var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Save Copy In...').first;
                      
                          //Find group
                          var group = prefsWin.groups.whoseTitle.is(groupName).first;
                      
                          //Find CheckBox and set it
                          var checkbox = group.checkBoxes.whoseTitle.is(checkboxName).first;
                          checkbox.checkboxSet({
                              targetValue: targetValue
                          });
                      }
                      setPrefCheckbox('Items To Copy', 'Audio Files', 'Enable');
                      

                      Thanks yet again,
                      Dustin

                      EDIT

                      nevermind, it was way easier than I thought.

                      sf.ui.proTools.windows.whoseTitle.is('Save Copy In...').first.checkBoxes.whoseTitle.is('Audio Files').first.checkboxSet({
                          targetValue: "Enable",
                      });
                      

                      Also, what's the right way to wrap code on this forum so it shows up with the proper formatting?

                      1. @Dustin_Harris I love it that you found the solution yourself :)

                        I edited your post so that you can see how to do the formatting (choose edit yourself). Basically you add three backticks ``` on a separate line before your code, and once again 3 backticks on a separate line after your code.

                      2. In reply toSeanH:
                        Chip Sloan @ChipSloan
                          2020-11-13 21:51:27.025Z

                          Hey all. I'm trying to use that code @chrscheuer has up there to change color coding of clips. Problem is there are 2 buttons named "Tracks and MIDI Channels". I want to change the second one and not the first one as I'm trying here but getting an error.

                          
                          function openPrefs() {
                              sf.ui.proTools.appActivateMainWindow();
                          
                              //Open up Preferences
                              sf.ui.proTools.menuClick({ menuPath: ['Pro Tools', 'Preferences...'] });
                          
                              //Wait for Preferences window to appear
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                              prefsWin.elementWaitFor();
                          }
                          
                          function setPrefCheckbox(tabName, groupName, checkboxName, targetValue) {
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                          
                              //Choose tab
                              prefsWin.children.whoseTitle.startsWith(tabName).first.elementClick();
                          
                              //Find group
                              var group = prefsWin.groups.whoseTitle.is(groupName).first;
                          
                              //Find CheckBox and set it
                              var checkbox = group.checkBoxes.whoseTitle.is(checkboxName).first;
                              checkbox.checkboxSet({
                                  targetValue: targetValue
                              });
                          }
                          
                          function setPrefRadioButton(tabName, groupName, radioButtonName) {
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                          
                              //Choose tab
                              prefsWin.children.whoseTitle.startsWith(tabName).first.elementClick();
                          
                              //Find group
                              var group = prefsWin.groups.whoseTitle.is(groupName).first;
                          
                              //Find RadioButton and click it
                              group.radioButtons.whoseTitle.is(radioButtonName).first.elementClick();
                          }
                          
                          function setPrefRadioButton2(tabName, groupName, groupName2, radioButtonName) {
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                          
                              //Choose tab
                              prefsWin.children.whoseTitle.startsWith(tabName).first.elementClick();
                          
                              //Find group
                              var group = prefsWin.groups.whoseTitle.is(groupName).first;
                              var group2 = group.groups.whoseTitle.is(groupName2).first;
                          
                              //Find RadioButton and click it
                              group2.radioButtons.whoseTitle.is(radioButtonName).first.elementClick();
                          }
                          
                          function closePrefs() {
                              //Click OK
                              var prefsWin = sf.ui.proTools.windows.whoseTitle.endsWith('Preferences').first;
                              prefsWin.buttons.whoseTitle.is("OK").first.elementClick();
                          
                              //Wait for Preferences window to close
                              prefsWin.elementWaitFor({ waitForNoElement: true });
                          }
                          
                          //Here you set your preferences:
                          openPrefs();
                          setPrefCheckbox('Display', 'Color Coding', 'Always Display Marker Colors', 'Enable');
                          setPrefRadioButton('Display', 'Color Coding', 'Track Color');
                          setPrefRadioButton2('Display', 'Color Coding', 'Default Clip Color Coding', 'Tracks and MIDI Channels');
                          closePrefs();
                          

                          How do I define that radio button under "Default Clip Color Coding" without changing the one by the same name under "Default Track Color Coding"?

                          Thanks.

                          1. Hi Chip,

                            Just a quick note - have you taken a look at our Pro Tools Preference Manager app? It takes care of storing and recalling all your settings :)

                            1. Chip Sloan @ChipSloan
                                2020-11-14 17:47:33.984Z

                                @chrscheuer, Thank you, I missed that and yeah, that helps. My question now would be what code could I use to trigger a recall of one of those settings in a script?

                                As always thank you for all of this, so good...

                                1. Chip Sloan @ChipSloan
                                    2020-11-14 23:11:11.318Z

                                    Also, I'm getting this error when I recall my settings:

                                    LOG] Could not apply settings to item: Cloud Storage Services -> undefined

                                    C

                              • Progress
                              • J
                                Jonathan Wales @Jonathan_Wales
                                  2020-02-06 05:14:21.881Z

                                  Hi Christian,

                                  I'm having a problem with the PT Menu item "Sends Default to "-INF" on the Mixing Setup page - because of the quote marks included in the name of the pref.

                                  What is the correct way to handle the pre-existing quote marks in the text?

                                  Thanks!

                                  1. J
                                    Jonathan Wales @Jonathan_Wales
                                      2020-02-06 05:18:26.794Zreplies toJonathan_Wales:

                                      Figured it out - using " for the embedded quotations.