No internet connection
  1. Home
  2. How to

Macro for Enabling Clip FX Preset on Selected Clip + Crossdafe

By Maxwell Smith @Maxwell_Smith
    2021-05-12 19:03:18.436Z

    Howdy Sound Flow peeps!

    Are there any pre-built actions for the Clip FX window? I'm tring to create a macro to do the following once I have highlighted a specific clip region:

    • Edit highlighted region into a single clip (Cmd E)
    • Enable a clip fx preset on selected clip
    • Expand selcted area by 5ms on both sides
    • Cross fade the newly selected area (Cmd F + "OK)

    I'm having difficulties finding actions for the clip fx window and commands to expand current selection. Any tips would be grately appreciated!

    Solved in post #4, click to view
    • 10 replies
    1. Curtis Macdonald @Curtis_Macdonald
        2021-05-13 03:58:52.708Z

        Bump!

        1. M
          In reply toMaxwell_Smith:
          Maxwell Smith @Maxwell_Smith
            2021-05-13 14:56:39.476Z

            Update on this! Think I'm getting close with this...

            sf.keyboard.press({
            keys: "cmd+e",
            });

            sf.keyboard.press({
            keys: "cmd+1",
            });

            sf.keyboard.press({
            keys: "cmd++",
            });

            sf.keyboard.press({
            keys: "alt++",
            });

            sf.keyboard.press({
            keys: "cmd+f",
            });

            sf.ui.proTools.windows.whoseTitle.contains('Batch Fades').first.buttons.whoseTitle.is('OK').allItems[0].elementClick();

            1. samuel henriques @samuel_henriques
                2021-05-13 15:52:52.675Z2021-05-13 16:20:34.040Z

                hello @Maxwell_Smith,

                almost there, it's always best to use menu items whenever possible. And I think I would be safe to set the grid value, otherwise it will extend on whatever is there. I can't choose 5msec though, how do you do it?

                As for the fades, are you using a preset as well?

                
                sf.ui.proTools.appActivateMainWindow()
                
                let gridValue = sf.ui.proTools.mainWindow.groups.whoseTitle.is("Grid/Nudge Cluster").first.popupButtons.whoseTitle.is("Grid Value").first.value.invalidate().value
                
                
                //  Set Grid value if it's not 0:00.010
                if (gridValue.trim() != "0:00.010") {
                    
                    sf.ui.proTools.gridSet({ gridValueName: "Min:Secs" })
                    sf.ui.proTools.gridSet({ gridValueName: "10 msec" })
                }
                
                // Separate Clips
                sf.ui.proTools.menuClick({
                    menuPath: ["Edit", "Separate Clip", "At Selection"],
                });
                
                // Extent end selection by Grid Value
                sf.keyboard.press({
                    keys: "alt+numpad minus",
                });
                
                // Extent start selection by Grid Value
                sf.keyboard.press({
                    keys: "cmd+numpad plus",
                });
                
                
                sf.ui.proTools.menuClick({
                    menuPath: ["Edit", "Fades", "Create..."],
                });
                // Set preset                                                                                                 [0] for presset 1, [1] for presset 2...
                sf.ui.proTools.windows.whoseTitle.is('Batch Fades').first.buttons.whoseTitle.is('Fade Preset Toggle').allItems[0].elementClick();
                
                sf.ui.proTools.windows.whoseTitle.is('Batch Fades').first.buttons.whoseTitle.is('OK').first.elementClick();
                
                
                
                // Open Clip Effects
                sf.ui.proTools.menuClick({
                    menuPath: ["View", "Other Displays", "Clip Effects"], targetValue: "Enable"
                });
                
                
                // Set preset                                                                   [0] for presset 1, [1] for presset 2...
                sf.ui.proTools.mainWindow.buttons.whoseTitle.is("ClipFX Preset Toggle").allItems[0].elementClick();
                
                Reply1 LikeSolution
                1. samuel henriques @samuel_henriques
                    2021-05-13 16:03:02.361Z

                    just noticed a mistake, and updated above.

                    Let me know how it goes.

                    1. samuel henriques @samuel_henriques
                        2021-05-13 16:21:11.157Z

                        Updated: It will set grid, only if to set already.

                        1. MMaxwell Smith @Maxwell_Smith
                            2021-05-13 17:10:10.002Z2021-05-13 19:09:20.165Z

                            This worked beautifully! Thank you so much for sharing this... We did make one change below, we had to add "shift" to get the nudge to work...

                            sf.ui.proTools.appActivateMainWindow()
                            
                            let gridValue = sf.ui.proTools.mainWindow.groups.whoseTitle.is("Grid/Nudge Cluster").first.popupButtons.whoseTitle.is("Grid Value").first.value.invalidate().value
                            
                            
                            //  Set Grid value if it's not 0:00.010
                            if (gridValue.trim() != "0:00.010") {
                                
                                sf.ui.proTools.gridSet({ gridValueName: "Min:Secs" })
                                sf.ui.proTools.gridSet({ gridValueName: "10 msec" })
                            }
                            
                            // Separate Clips
                            sf.ui.proTools.menuClick({
                                menuPath: ["Edit", "Separate Clip", "At Selection"],
                            });
                            
                            
                            // Extent end selection by Grid Value
                            sf.keyboard.press({
                                keys: "alt+shift+numpad minus",
                            });
                            
                            // Extent start selection by Grid Value
                            sf.keyboard.press({
                                keys: "cmd+shift+numpad plus",
                            });
                            
                            
                            sf.ui.proTools.menuClick({
                                menuPath: ["Edit", "Fades", "Create..."],
                            });
                            // Set preset                                                                                                 [0] for presset 1, [1] for presset 2...
                            sf.ui.proTools.windows.whoseTitle.is('Batch Fades').first.buttons.whoseTitle.is('Fade Preset Toggle').allItems[0].elementClick();
                            
                            sf.ui.proTools.windows.whoseTitle.is('Batch Fades').first.buttons.whoseTitle.is('OK').first.elementClick();
                            
                            
                            
                            // Open Clip Effects
                            sf.ui.proTools.menuClick({
                                menuPath: ["View", "Other Displays", "Clip Effects"], targetValue: "Enable"
                            });
                            
                            
                            // Set preset                                                                   [0] for presset 1, [1] for presset 2...
                            sf.ui.proTools.mainWindow.buttons.whoseTitle.is("ClipFX Preset Toggle").allItems[0].elementClick();
                            
                            
                            1. samuel henriques @samuel_henriques
                                2021-05-13 17:28:03.176Z2021-05-13 17:42:44.443Z

                                cool,
                                on mine, if I add shift, it will do a larger selection, but not by trimming.

                                check out his video where Kitch explains how to quote code in the forum
                                How to quote code in the SoundFlow forum.

                                1. samuel henriques @samuel_henriques
                                    2021-05-13 17:45:20.121Z

                                    And you are using the first code I sent, the current one, won't change the grid value every time you run the code, only if it's not correct

                                    1. MMaxwell Smith @Maxwell_Smith
                                        2021-05-13 19:03:28.503Z

                                        Thanks for that! Well update the code.

                                        Curious what the syntax might be for editing specific parameters in the clip FX window? We have a preset made currently but it would be great to set HP settings in the code if the presets ever change. Any good resources for learning that sort of sytax?

                                        Thanks again for all the help with this!

                                        1. samuel henriques @samuel_henriques
                                            2021-05-13 20:58:05.152Z

                                            that's a bit tricky, the way to click stuff would be using the "click UI element" action do get the "address" of the buttons, but avid designed the clip effects as it would a plugin, in the sense that soundFlow doesn't have access to the buttons. So to click them you would use "Mouse Click Relative to UI Element", Kitch made a video explaining how you use it here:
                                            How to use "Mouse Click Relative to UI Element" to simulate mouse clicks in Pro Tools.
                                            The problem here is that you can't read the state of the buttons, to be able to know if you need to click them, and to move eq, it's possible, but not great, because you need to program mouse movements, It's really cool to see it move though.