No internet connection
  1. Home
  2. How to

How to set Clip Gain Nudge Value to a specific value?

Solved in post #6, click to view
  • 11 replies
    1. Hi everyone. This is my first time here, so dont be mad if i will write something stupid or in a wrong place. I have a problem, because I dont know, how to choose Clip Gain Nudge Value window to enter desired value. I want my script to ask for desired value of this Nudge and then do super quick setup.

      1. Hi Michał. I moved your question to a new thread as the old one had already been answered.

        The Clip Gain Nudge Value you want to set, where is that? Is that somewhere in preferences?
        Can you share a screenshot?

          1. Great, thanks.

            This should set it to 5 dB:

            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 setPrefTextField(tabName, groupName, textFieldIndex, textFieldValue) {
                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 textField and click it
                group.textFields.allItems[textFieldIndex].elementClick();
            
                sf.keyboard.type({ text: textFieldValue });
            }
            
            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();
            setPrefTextField('Editing', 'Clips', 0, '5');
            closePrefs();
            
            ReplySolution
            1. This works great! Thanks :)

              1. In reply tochrscheuer:

                Hey Christian. This is great but doesn't work for 0.5. It just sets it to 5.0. Any suggestions for a workaround please?

                1. samuel henriques @samuel_henriques
                    2020-09-08 20:57:56.412Z

                    Hello,
                    I've changed Christian's code to do "0.5" as you asked. You can change the values "0" and "5" on the code to do whatever you want.
                    Be aware I'm very new with javascript and key pressing is very childish, but looks like it's working.
                    Apologies Christian, I hope you wont be mad with this.

                    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 setnudgevalue() {
                        sf.keyboard.press({
                        keys: "tab",
                    });
                    
                    sf.keyboard.press({
                        keys: "0",
                    });
                    sf.keyboard.press({
                        keys: "right",
                    });
                    sf.keyboard.press({
                        keys: "5",
                    });
                    }
                    
                    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();
                    setnudgevalue();
                    closePrefs();
                    
                    1. Hi @samuel_henriques. Haha no, definitely not mad - it's only great to see the community growing and people helping each other :) Thanks for sharing. This is very close to what I would have recommended :)

                      1. This is great and good info to know for further scripts, thanks for your help!

                        1. This version will ask you for the nudge value before changing it - avoiding the need to change the script:
                          Pro Tools - Clip Gain Nudge Value #post-3