No internet connection
  1. Home
  2. How to

Inactive and Reactive plugin

By Emil Woxen @Emil_Woxen
    2020-12-28 21:11:06.971Z

    How would one go about Inactivating plugin on insert 1, wait for it to inactivate, and then re-activate it again?

    Why i need this:
    I use EQ3 in preview mode whilst listening sweeping the EQ bands, and this often promps a bug in pro tools, which inables one to move several bands, and so you have to inactivate the plugin, and then reactivate it in order to make it function again / for some reason Avid have choosen not fix the bug, ever..

    • 15 replies

    There are 15 replies. Estimated reading time: 17 minutes

    1. samuel henriques @samuel_henriques
        2020-12-29 10:23:12.720Z

        Hello @Emil_Woxen,

        try this,

        sf.ui.proTools.appActivateMainWindow();
        
        const insertA = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts A-E').first.buttons.whoseTitle.is('Insert Assignment A').first
        
        insertA.popupMenuSelect({
            isRightClick: true,
            menuPath: ["Make Inactive"],
            targetValue: "Enable",
        });
        
        insertA.popupMenuSelect({
            isRightClick: true,
            menuPath: ["Make Active"],
            targetValue: "Enable",
        });
        
        1. samuel henriques @samuel_henriques
            2020-12-29 10:27:29.167Z

            this one is faster, but could be less stable

            const insertA = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts A-E').first.buttons.whoseTitle.is('Insert Assignment A').first.mouseClickElement({
                isCommand:true,
                isControl:true,
                clickCount:2
            })
            
            1. EEmil Woxen @Emil_Woxen
                2020-12-29 11:11:21.309Z

                It's perfect! Thank you so much!

                Stupid bug has been hunting me for years, and it seems like they're never gonna fix it..

              • D
                In reply toEmil_Woxen:
                Dean Landon @Dean
                  2025-05-19 07:17:38.354Z

                  Hi Samuel,

                  I tested your first script and it successfully deactivated and activated all 10 plugins on my inserts. I copied lines 3 to 9 ten times, updating each to target the appropriate inserts from A through J.

                  The issue I'm running into is that not all of my Pro Tools sessions have exactly 10 plugins on the inserts—each session varies. When that happens, SoundFlow throws an error.

                  Is there a way to modify the script so it dynamically adjusts based on how many plugins are present, and only tries to activate or deactivate the ones that exist?

                  Thanks so much!

                  1. Chad Wahlbrink @Chad2025-05-19 16:46:04.714Z

                    Hi, @Dean,

                    This should do the trick for you:

                    
                    if (!sf.ui.proTools.isRunning) throw `Pro Tools is not running`;
                    
                    sf.ui.proTools.appActivateMainWindow();
                    sf.ui.proTools.mainWindow.invalidate();
                    
                    /**
                     * Activate or Deactivate Inserts
                     * @param {'Activate'|'Deactivate'} activateOrDeactivate
                     */
                    function activateOrdeactivateActiveInserts(activateOrDeactivate) {
                        let inserts;
                    
                        if (activateOrDeactivate == 'Deactivate') {
                            // Array of Active Inserts - Inserts are active when value is "" or "open", otherwise "inactive",  "inactive and open", "unassigned"
                            inserts = sf.ui.proTools.selectedTrack.invalidate().insertSelectorButtons.filter(x => x.value.value == "" || x.value.value == "open").map(x => x.title.value).map(x => x.slice(-1));
                        } else if (activateOrDeactivate == 'Activate') {
                            // Array of Active Inserts - Inserts are active when value is "" or "open", otherwise "inactive",  "inactive and open", "unassigned"
                            inserts = sf.ui.proTools.selectedTrack.invalidate().insertSelectorButtons.filter(x => x.value.value == "inactive" || x.value.value == "inactive and open" ).map(x => x.title.value).map(x => x.slice(-1));
                        }
                    
                        // Filter Insert Buttons by Active Inserts
                        let insertButtons = sf.ui.proTools.selectedTrack.invalidate().insertButtons.filter(insert => inserts.includes(insert.title.value.slice(-1)));
                    
                        // Deactivate each Active Insert 
                        insertButtons.forEach(i => i.mouseClickElement({ isControl: true, isCommand: true }))
                    }
                    
                    activateOrdeactivateActiveInserts('Deactivate');
                    activateOrdeactivateActiveInserts('Activate');
                    
                  2. D
                    In reply toEmil_Woxen:
                    Dean Landon @Dean
                      2025-05-19 17:21:24.644Z

                      Hi Chad,

                      Thanks for the information. I appreciate it.

                      Last night, my brother and I experimented with this command, and it worked. This is the activate command, and I have a similar deactivate command.

                      Should I include your command above or below mine, or is your command sufficient?

                      Thanks again!

                      sf.ui.proTools.appActivateMainWindow();

                      const insertA = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts A-E').first.buttons.whoseTitle.is('Insert Assignment A').first

                      insertA.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });
                      const insertB = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts A-E').first.buttons.whoseTitle.is('Insert Assignment B').first

                      insertB.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });
                      const insertC = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts A-E').first.buttons.whoseTitle.is('Insert Assignment C').first

                      insertC.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });
                      const insertD = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts A-E').first.buttons.whoseTitle.is('Insert Assignment D').first

                      insertD.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });
                      const insertE = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts A-E').first.buttons.whoseTitle.is('Insert Assignment E').first

                      insertE.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });
                      const insertF = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts F-J').first.buttons.whoseTitle.is('Insert Assignment F').first

                      insertF.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });
                      const insertG = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts F-J').first.buttons.whoseTitle.is('Insert Assignment G').first

                      insertG.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });
                      const insertH = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts F-J').first.buttons.whoseTitle.is('Insert Assignment H').first

                      insertH.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });
                      const insertI = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts F-J').first.buttons.whoseTitle.is('Insert Assignment I').first

                      insertI.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });
                      const insertJ = sf.ui.proTools.selectedTrack.groups.whoseTitle.is('Inserts F-J').first.buttons.whoseTitle.is('Insert Assignment J').first

                      insertJ.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ["Make Active"],
                      targetValue: "Enable",
                      });

                      1. Chad Wahlbrink @Chad2025-05-19 18:18:24.572Z

                        Your script would work if the inserts were in all 10 slots. However, it would fail if any of those slots were missing inserts.

                        For sharing code in the forum, view this tutorial:
                        How to quote code in the SoundFlow forum.

                      2. D
                        In reply toEmil_Woxen:
                        Dean Landon @Dean
                          2025-05-19 17:28:46.017Z

                          Hey Chad,

                          I tried your command, and it activates immediately after it deactivates.

                          Could you please guide me on how to create one or the other? I’m quite new to this. :)

                          Thanks a lot!

                          1. Chad Wahlbrink @Chad2025-05-19 18:14:48.432Z

                            Hi, @Dean,

                            You can control this via the line with:

                            activateOrdeactivateActiveInserts('Activate');
                            

                            Line 28 in this script:

                            if (!sf.ui.proTools.isRunning) throw `Pro Tools is not running`;
                            
                            sf.ui.proTools.appActivateMainWindow();
                            sf.ui.proTools.mainWindow.invalidate();
                            
                            /**
                             * Activate or Deactivate Inserts
                             * @param {'Activate'|'Deactivate'} activateOrDeactivate
                             */
                            function activateOrdeactivateActiveInserts(activateOrDeactivate) {
                                let inserts;
                            
                                if (activateOrDeactivate == 'Deactivate') {
                                    // Array of Active Inserts - Inserts are active when value is "" or "open", otherwise "inactive",  "inactive and open", "unassigned"
                                    inserts = sf.ui.proTools.selectedTrack.invalidate().insertSelectorButtons.filter(x => x.value.value == "" || x.value.value == "open").map(x => x.title.value).map(x => x.slice(-1));
                                } else if (activateOrDeactivate == 'Activate') {
                                    // Array of Active Inserts - Inserts are active when value is "" or "open", otherwise "inactive",  "inactive and open", "unassigned"
                                    inserts = sf.ui.proTools.selectedTrack.invalidate().insertSelectorButtons.filter(x => x.value.value == "inactive" || x.value.value == "inactive and open" ).map(x => x.title.value).map(x => x.slice(-1));
                                }
                            
                                // Filter Insert Buttons by Active Inserts
                                let insertButtons = sf.ui.proTools.selectedTrack.invalidate().insertButtons.filter(insert => inserts.includes(insert.title.value.slice(-1)));
                            
                                // Deactivate each Active Insert 
                                insertButtons.forEach(i => i.mouseClickElement({ isControl: true, isCommand: true }))
                            }
                            
                            activateOrdeactivateActiveInserts('Activate');
                            
                            1. Chad Wahlbrink @Chad2025-05-19 18:15:19.687Z

                              @Dean, for deactivate, you would just change line 28 to:

                              activateOrdeactivateActiveInserts('Deactivate');
                              
                          2. D
                            In reply toEmil_Woxen:
                            Dean Landon @Dean
                              2025-05-19 21:22:49.247Z

                              Hi Chad, thanks again for the help.

                              When I "Activate" the 5 plugins on the inserts, I get this failed message. Am I missing something?

                              Thanks again!

                              1. Chad Wahlbrink @Chad2025-05-19 21:49:45.526Z

                                Hi, @Dean,

                                Are you saying it fails when you use the script to activate five inserts?

                                The only thing I will note is that this specific script does not play well if the tracks are set to "mini" or "micro." Otherwise, this script seems to work as expected for me.

                                It might be best to ask this question using the "Script or Macro Help Workflow":
                                https://soundflow.org/docs/help#script-help

                                This would allow me to make sure we are using the same code and there isn't a system-specific error happening. This short video explains how to ask for help and upload information in this way:
                                https://youtu.be/H3eeKvUIx7g

                                Thanks, Dean.

                              2. D
                                In reply toEmil_Woxen:
                                Dean Landon @Dean
                                  2025-05-19 21:54:54.270Z

                                  Hi Chad,

                                  I never use Mini or Micro. Most of my Instr tracks are Small, but this particular track is always Medium.

                                  I'll post my question where you suggested.

                                  Thanks again!

                                  1. D
                                    In reply toEmil_Woxen:
                                    Dean Landon @Dean
                                      2025-05-19 22:39:34.920Z

                                      All done Chad. Thanks

                                      1. Chad Wahlbrink @Chad2025-05-20 14:43:32.267Z

                                        Posting here for anyone who is curious, more stable code for this is here: