No internet connection
  1. Home
  2. How to

Nudge settings

By John McPhillips @John_McPhillips
    2021-06-05 13:42:24.565Z

    Is there a way to change both the Activity/Ruler setting while also changing the nudge value? I would like to be able to nudge in both seconds and frames without having to change the Activity with my mouse in the Nudge dropdown.

    Alternatively is there a macro to change the Activity Ruler (I know PT doesn't have a kb shorcut) as this would then default to bar/second/frame using 1 & 2 on the numerical keypad?

    Any info would be great

    John

    • 18 replies
    1. samuel henriques @samuel_henriques
        2021-06-05 15:09:18.351Z

        this should do it, if I understood properly what you asked for.

        let me know:

        /**
         * @param {"Bars|Beats"|"Min:Secs"|"Timecode"|"Feet+Frames"|"Samples"} timeScale
         */
        function setNudge(timeScale, value){
        sf.ui.proTools.mainWindow.groups.whoseTitle.is("Grid/Nudge Cluster").first.popupButtons.whoseTitle.is("Nudge value").first.popupMenuSelect({
            menuPath: [timeScale],
        });
        sf.ui.proTools.nudgeSet({ value: value })
        }
        
        
        // Change Nudge Here
        //       Time Scale    Nudge value
        setNudge("Timecode", "00:00:01:00")
        
        

        If you would like to have a toggle between a few settings, let me know what they are.

        1. JJohn McPhillips @John_McPhillips
            2021-06-05 15:23:04.135Z

            Thanks Samuel - I've copied this into a newly created script and dragged it into a Stream Deck button but it's not working. Maybe I haven't pasted/formatted the script in properly. Sorry, I know little to nothing about script.....

            1. samuel henriques @samuel_henriques
                2021-06-05 15:38:25.875Z

                that's cool.

                what doesn't work?

                as it's written, it should set nudge to 1 frame.

                does i work by itself?

                1. samuel henriques @samuel_henriques
                    2021-06-05 15:43:10.244Z

                    if you press run command on soundFlow, does it work?

                    the nudge area must be visible.

                    1. JJohn McPhillips @John_McPhillips
                        2021-06-05 16:38:51.865Z

                        Hi Samuel - it says "could not open popup menu"

                        Here's what I did - I copied all the script from your message, created a new script clicking the blue "+" button in editor and pasted in your script into the first line 1) on the right hand panel.

                        1. samuel henriques @samuel_henriques
                            2021-06-05 16:42:20.050Z

                            can you see this when you press the command?

                            1. JJohn McPhillips @John_McPhillips
                                2021-06-05 16:44:39.517Z

                                No, it stays at the previous setting (Samples)

                                1. samuel henriques @samuel_henriques
                                    2021-06-05 16:46:14.164Z

                                    to change these values, the area needs to be visible

                                    are you using the mix window and want to change the nudge?

                                    1. samuel henriques @samuel_henriques
                                        2021-06-05 16:48:54.596Z2021-06-06 10:00:11.565Z

                                        here's a version that you don't see the popup if you are changing value of the same time scale.

                                        // get current time scale
                                        function getTimeScale(value) {
                                        
                                            let timeScale
                                            /// Bars Beats .  
                                            if (value.includes("|")) timeScale = "Bars|Beats"
                                            //  Min Secs .    
                                            else if (value.split(":").length == 2 && value.includes(".")) timeScale = "Min:Secs"
                                            //  Time code
                                            else if (value.split(":").length == 4) timeScale = "Timecode"
                                            //  Feet+Frames
                                            else if (value.includes("+")) timeScale = "Feet+Frames"
                                            //  Samples.     
                                            else timeScale = "Samples"
                                        
                                            return timeScale
                                        }
                                        
                                        function setNudge(value) {
                                        
                                            const curentNudgeValue = sf.ui.proTools.mainWindow.groups.whoseTitle.is("Grid/Nudge Cluster").first.textFields.first.value.invalidate().value
                                        
                                            const userTimeScale = getTimeScale(value)
                                            const currentTimeScale = getTimeScale(curentNudgeValue)
                                        
                                            if (currentTimeScale != userTimeScale) {
                                                sf.ui.proTools.mainWindow.groups.whoseTitle.is("Grid/Nudge Cluster").first.popupButtons.whoseTitle.is("Nudge value").first.popupMenuSelect({
                                                    menuPath: [userTimeScale],
                                                });
                                            }
                                        
                                            sf.ui.proTools.nudgeSet({ value: value })
                                        }
                                        
                                        
                                        
                                        sf.ui.proTools.appActivateMainWindow()
                                        sf.ui.proTools.menuClick({ menuPath: ['Window', 'Edit'] });
                                        
                                        
                                        //  nudge value exactly as writen in pro tools
                                        setNudge("00:00:00:01.00")
                                        
                                        1. JJohn McPhillips @John_McPhillips
                                            2021-06-05 19:26:38.806Z

                                            Thanks, no, I was using the Edit window. I've tried that last one you sent and I get an error message saying "Parent's UI Element was null - Line 21"

                                            John

                                            1. samuel henriques @samuel_henriques
                                                2021-06-05 19:42:25.426Z

                                                Just updated another version.

                                                Could you test it please.
                                                And test as well by running from the soundFlow editor?

                                                1. samuel henriques @samuel_henriques
                                                    2021-06-05 19:44:19.902Z

                                                    From your descriptions, it seams the nudge area could be behind something, but if you can see it I'm not sure what it could be.

                                                    1. samuel henriques @samuel_henriques
                                                        2021-06-06 10:00:49.956Z

                                                        Hello John,

                                                        Any luck with this?

                                                        1. JJohn McPhillips @John_McPhillips
                                                            2021-06-06 11:41:33.043Z

                                                            Hi Samuel - I'm still getting "Parent's UI Element was null"... I've tried running from the editor and from stream deck with the Edit window open and in view.

                                                            I wouldn't worry about it, I was just trying to avoid a click but I can live with it!

                                                            Thanks again for the help.

                                                            John

                                                            1. samuel henriques @samuel_henriques
                                                                2021-06-06 12:06:31.912Z

                                                                very weird, it would be good to figure it out though, for future scripts.

                                                                @Kitch, could you check this out, please?

                                                                1. samuel henriques @samuel_henriques
                                                                    2022-10-27 09:58:08.941Z

                                                                    @Davide_Docente did you figure how to do the min:sec nudge?
                                                                    I can't see it anymore. I was trying to figure this, min:sec doesn't work like the others for custom value. But can't see your post anymore.
                                                                    In the mean time I'm not sure if there are built in macros for this. And if you can live with what is available in the pro tools popup, it's easier to code.

                                                                    1. samuel henriques @samuel_henriques
                                                                        2022-10-27 11:32:27.883Z

                                                                        Hers's a version that will work with min:sec.
                                                                        It's manual labour for sf, but thats what I managed so far.

                                                                        function setMinSecNudge(value) {
                                                                        
                                                                            const clickCustomNudgeArea = () => sf.ui.proTools.mainWindow.gridNudgeCluster.textFields.whoseTitle.is("Nudge Custom Value").first.elementClick();
                                                                            const right = () => sf.keyboard.press({ keys: "right", fast: true });
                                                                            const zeroOut = () => sf.keyboard.press({ keys: "numpad 0", fast: true });
                                                                            const type = (text) => sf.keyboard.type({ text: text });
                                                                            const goToMin = () => sf.keyboard.press({ keys: "numpad equals", fast: true });
                                                                            const pressReturn = () => sf.keyboard.press({ keys: "return", });
                                                                        
                                                                            let [min, sec, msec] = value.split(/[:.]/)
                                                                        
                                                                            clickCustomNudgeArea();
                                                                            zeroOut();
                                                                        
                                                                            goToMin();
                                                                            type(min);
                                                                            right();
                                                                            type(sec);
                                                                            right();
                                                                            type(msec);
                                                                            pressReturn();
                                                                        
                                                                        };
                                                                        
                                                                        
                                                                        // get current time scale
                                                                        function getTimeScale(value) {
                                                                        
                                                                            let timeScale
                                                                            /// Bars Beats .  
                                                                            if (value.includes("|")) timeScale = "Bars|Beats"
                                                                            //  Min Secs .    
                                                                            else if (value.split(":").length == 2 && value.includes(".")) timeScale = "Min:Secs"
                                                                            //  Time code
                                                                            else if (value.split(":").length == 4) timeScale = "Timecode"
                                                                            //  Feet+Frames
                                                                            else if (value.includes("+")) timeScale = "Feet+Frames"
                                                                            //  Samples.     
                                                                            else timeScale = "Samples"
                                                                        
                                                                            return timeScale
                                                                        }
                                                                        
                                                                        function setNudge(value) {
                                                                        
                                                                            const curentNudgeValue = sf.ui.proTools.mainWindow.groups.whoseTitle.is("Grid/Nudge Cluster").first.textFields.first.value.invalidate().value
                                                                        
                                                                            const userTimeScale = getTimeScale(value)
                                                                            const currentTimeScale = getTimeScale(curentNudgeValue)
                                                                        
                                                                            if (currentTimeScale != userTimeScale) {
                                                                                sf.ui.proTools.mainWindow.groups.whoseTitle.is("Grid/Nudge Cluster").first.popupButtons.whoseTitle.is("Nudge value").first.popupMenuSelect({
                                                                                    menuPath: [userTimeScale],
                                                                                });
                                                                            }
                                                                        
                                                                            if (userTimeScale === "Min:Secs") {
                                                                                setMinSecNudge(value)
                                                                            } else {
                                                                                sf.ui.proTools.nudgeSet({ value: value })
                                                                            }
                                                                        }
                                                                        
                                                                        
                                                                        
                                                                        //sf.ui.proTools.appActivateMainWindow()
                                                                        sf.ui.proTools.menuClick({ menuPath: ['Window', 'Edit'] });
                                                                        
                                                                        
                                                                        //  nudge value exactly as writen in pro tools
                                                                        setNudge("03:01.550")
                                                                        
                                                                        1. RRobert Mallory @Robert_Mallory
                                                                            2024-01-19 17:26:19.438Z

                                                                            Been looking all over this forum for a way to set the Nudge value to 500ms when working in Min:Sec mode in PT. This seems to do the trick, thanks so much. Do you think Min:Sec nudge and grid values will be included in future SF versions, along with the Bars|Beats and Feet+Frame and Timecode macros currently available? It would be so helpful.