No internet connection
  1. Home
  2. How to

Removing a plugin on any insert.

By Daniel Holsinger @Daniel_Holsinger
    2022-05-16 21:08:32.263Z

    Hey people, is there a way to remove a plugin that is open and already selected?

    For example, if you try a plugin and decided it doesn't work and want to remove it. It could be on any random insert point from 1-10 (not a specific insert point). And also shut down the window that's leftover.

    thanks

    Solved in post #24, click to view
    • 29 replies

    There are 29 replies. Estimated reading time: 25 minutes

    1. Ben Rubin @Ben_Rubin
        2022-05-17 12:23:26.611Z

        Find the package, "Scheps Move Inserts" in the store. It can do that.

        1. DDaniel Holsinger @Daniel_Holsinger
            2022-05-17 14:23:30.086Z

            Thanks, I tried this and it isn't quite what I am looking for. I'm hoping it can be a bit more intelligent to know that the plugin you want to remove is already open and on-screen....this may be an overextension of the software....fingers crossed someone has the answer.

          • Try this:
            This will remove the plugin that is open and selected - the plugin window must be active (the red button in the upper left should be red).

            Additionally the plugin slots must be visible and unobscured by other windows:

            const slotLetters = "abcdefghij"
            
            // Get focused plugin window
            var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitleStartingWith("Plug-in").invalidate();
            
            // Check if plugin window is an inactive Plugin and get its info
            if (!frontPluginWin.hasLiveValidUI) {
                var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitle("");
            };
            
            // Check if a plugin window is open then get plugin slot and track name from it
            if (frontPluginWin) {
                try {
                    var slot = frontPluginWin.popupButtons.whoseTitle.is("Insert Position selector").first.value.invalidate().value;
                    var pluginTrack = frontPluginWin.popupButtons.whoseTitle.is("Track Selector").first.value.invalidate().value
            
                    /* if error then no plugin window is open */
                } catch (err) {
                    log("Remove Plugin", "To remove plug-in, open plugin in that slot");
                    throw 0
                };
            };
            
            // Select plugin's track and scroll into view
            sf.ui.proTools.trackSelectByName({names:[pluginTrack]});
            
            sf.ui.proTools.selectedTrack.trackScrollToView();
            
            // Select "no insert from open plugin window's insert selector
            try {
                sf.ui.proTools.selectedTrack.insertSelectorButtons[slotLetters.lastIndexOf(slot)].popupMenuSelect({
                    menuPath: ["no insert"],
                });
            } catch (err) {
                log("Cannot click insert selector popup - be sure inserts are visible and not obscured by another window")
            };
            
            
            
            
            
            1. DDaniel Holsinger @Daniel_Holsinger
                2022-05-17 19:19:19.210Z

                You Legend!!!! This is amazing. Worked perfectly. This works perfectly as described mate!

                1. In reply toChris_Shaw:

                  This will leave a blank plugin window when done but since you requested this script to try out different EQs etc, then you can use the plugin selector in this window to try something else .

                  1. DDaniel Holsinger @Daniel_Holsinger
                      2022-05-17 19:21:55.784Z

                      Yes, that doesn't really bug me. Since the scenario is to try a plugin and then try another. It's not too much of a big deal.

                      1. In reply toChris_Shaw:
                        DDaniel Holsinger @Daniel_Holsinger
                          2022-05-17 19:34:44.801Z

                          Here is the fix to remove the floating window afterwards

                          
                          const slotLetters = "abcdefghij"
                          
                          // Get focused plugin window
                          var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitleStartingWith("Plug-in").invalidate();
                          
                          // Check if plugin window is an inactive Plugin and get its info
                          if (!frontPluginWin.hasLiveValidUI) {
                              var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitle("");
                          };
                          
                          // Check if a plugin window is open then get plugin slot and track name from it
                          if (frontPluginWin) {
                              try {
                                  var slot = frontPluginWin.popupButtons.whoseTitle.is("Insert Position selector").first.value.invalidate().value;
                                  var pluginTrack = frontPluginWin.popupButtons.whoseTitle.is("Track Selector").first.value.invalidate().value
                          
                                  /* if error then no plugin window is open */
                              } catch (err) {
                                  log("Remove Plugin", "To remove plug-in, open plugin in that slot");
                                  throw 0
                              };
                          };
                          
                          // Select plugin's track and scroll into view
                          sf.ui.proTools.trackSelectByName({names:[pluginTrack]});
                          
                          sf.ui.proTools.selectedTrack.trackScrollToView();
                          
                          // Select "no insert from open plugin window's insert selector
                          try {
                              sf.ui.proTools.selectedTrack.insertSelectorButtons[slotLetters.lastIndexOf(slot)].popupMenuSelect({
                                  menuPath: ["no insert"],
                              });
                          } catch (err) {
                              log("Cannot click insert selector popup - be sure inserts are visible and not obscured by another window")
                          };
                          
                          sf.ui.proTools.viewCloseTempFloatingWindows();
                          
                          
                          1. DDaniel Holsinger @Daniel_Holsinger
                              2022-05-17 19:36:15.612Z

                              The only issue is it closes all temporary floating windows. Need to find a solution. I'll keep working on it.

                          2. In reply toChris_Shaw:
                            Ben Rubin @Ben_Rubin
                              2022-05-17 19:34:07.799Z

                              Great little script, @Chris_Shaw! Very handy.

                              I added this bit of code to the bottom of mine so the plugin window closes unless I hold down Command.

                              //Close the Plugin Window if the CMD key is not held down
                              if (!event.keyboardState.hasCommand) {
                                  sf.ui.proTools.windows.whoseTitle.startsWith("Plug-in: ").first.windowClose();
                              }
                              
                              1. DDaniel Holsinger @Daniel_Holsinger
                                  2022-05-17 19:40:10.187Z

                                  I believe this is the final fix for this.

                                  const slotLetters = "abcdefghij"
                                  
                                  // Get focused plugin window
                                  var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitleStartingWith("Plug-in").invalidate();
                                  
                                  // Check if plugin window is an inactive Plugin and get its info
                                  if (!frontPluginWin.hasLiveValidUI) {
                                      var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitle("");
                                  };
                                  
                                  // Check if a plugin window is open then get plugin slot and track name from it
                                  if (frontPluginWin) {
                                      try {
                                          var slot = frontPluginWin.popupButtons.whoseTitle.is("Insert Position selector").first.value.invalidate().value;
                                          var pluginTrack = frontPluginWin.popupButtons.whoseTitle.is("Track Selector").first.value.invalidate().value
                                  
                                          /* if error then no plugin window is open */
                                      } catch (err) {
                                          log("Remove Plugin", "To remove plug-in, open plugin in that slot");
                                          throw 0
                                      };
                                  };
                                  
                                  // Select plugin's track and scroll into view
                                  sf.ui.proTools.trackSelectByName({names:[pluginTrack]});
                                  
                                  sf.ui.proTools.selectedTrack.trackScrollToView();
                                  
                                  // Select "no insert from open plugin window's insert selector
                                  try {
                                      sf.ui.proTools.selectedTrack.insertSelectorButtons[slotLetters.lastIndexOf(slot)].popupMenuSelect({
                                          menuPath: ["no insert"],
                                      });
                                  } catch (err) {
                                      log("Cannot click insert selector popup - be sure inserts are visible and not obscured by another window")
                                  };
                                  
                                  sf.ui.proTools.viewCloseCurrentPluginWindow();
                                  
                                  
                                  1. In reply toBen_Rubin:

                                    Hmm, that only works on my end if it's before // Select "no insert from open plugin window's insert selector.
                                    Once the plugin is removed, the remaining window has no title so the script fails (for me at least).

                                    1. I'm a bit busy now but I should add some code to clear a slot if the plugin is inactive.

                                      1. Which would be handy for tidying up a session.

                                      2. In reply toChris_Shaw:
                                        DDaniel Holsinger @Daniel_Holsinger
                                          2022-05-17 19:49:32.205Z

                                          yes it failed for me as well

                                        • In reply toBen_Rubin:
                                          DDaniel Holsinger @Daniel_Holsinger
                                            2022-05-17 19:51:27.422Z

                                            Totally missed this... We have the winner I believe.

                                            const slotLetters = "abcdefghij"
                                            
                                            // Get focused plugin window
                                            var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitleStartingWith("Plug-in").invalidate();
                                            
                                            // Check if plugin window is an inactive Plugin and get its info
                                            if (!frontPluginWin.hasLiveValidUI) {
                                                var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitle("");
                                            };
                                            
                                            // Check if a plugin window is open then get plugin slot and track name from it
                                            if (frontPluginWin) {
                                                try {
                                                    var slot = frontPluginWin.popupButtons.whoseTitle.is("Insert Position selector").first.value.invalidate().value;
                                                    var pluginTrack = frontPluginWin.popupButtons.whoseTitle.is("Track Selector").first.value.invalidate().value
                                            
                                                    /* if error then no plugin window is open */
                                                } catch (err) {
                                                    log("Remove Plugin", "To remove plug-in, open plugin in that slot");
                                                    throw 0
                                                };
                                            };
                                            
                                            // Select plugin's track and scroll into view
                                            sf.ui.proTools.trackSelectByName({names:[pluginTrack]});
                                            
                                            sf.ui.proTools.viewCloseCurrentPluginWindow();
                                            
                                            // Select "no insert from open plugin window's insert selector
                                            try {
                                                sf.ui.proTools.selectedTrack.insertSelectorButtons[slotLetters.lastIndexOf(slot)].popupMenuSelect({
                                                    menuPath: ["no insert"],
                                                });
                                            } catch (err) {
                                                log("Cannot click insert selector popup - be sure inserts are visible and not obscured by another window")
                                            };
                                            
                                            //Close the Plugin Window if the CMD key is not held down
                                            if (!event.keyboardState.hasCommand) {
                                                sf.ui.proTools.windows.whoseTitle.startsWith("Plug-in: ").first.windowClose();
                                            }
                                            1. DDaniel Holsinger @Daniel_Holsinger
                                                2022-05-17 20:22:59.846Z

                                                Please note @Chris_Shaw and @Ben_Rubin made the code. I just copied what was needed to make it work. Also this only works in the Edit Window currently.

                                                1. I could make it to work in the mix window but it's a MUCH bigger script

                                                  1. DDaniel Holsinger @Daniel_Holsinger
                                                      2022-05-17 21:31:57.815Z

                                                      For another time. I work mainly in the edit window anyway. Still be handy to have eventually tho. Pumped to have this working tho. Appreciate the help

                                                      1. This is a bit more robust.
                                                        This version will allow you to remove an inactive plugin.

                                                        const slotLetters = "abcdefghij"
                                                        
                                                        // Get focused plugin window
                                                        var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitleStartingWith("Plug-in").invalidate();
                                                        
                                                        // Check if plugin window is an inactive Plugin and get its info
                                                        if (!frontPluginWin.hasLiveValidUI) {
                                                            var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitle("");
                                                        };
                                                        
                                                        // Check if a plugin window is open then get plugin slot and track name from it
                                                        if (frontPluginWin) {
                                                            try {
                                                                var slot = frontPluginWin.popupButtons.whoseTitle.is("Insert Position selector").first.value.invalidate().value;
                                                                var pluginTrack = frontPluginWin.popupButtons.whoseTitle.is("Track Selector").first.value.invalidate().value
                                                        
                                                                /* if error then no plugin window is open */
                                                            } catch (err) {
                                                                log("Remove Plugin", "To remove plug-in, open plugin in that slot");
                                                                throw 0
                                                            };
                                                        };
                                                        // Select plugin's track and scroll into view
                                                        sf.ui.proTools.trackSelectByName({ names: [pluginTrack] });
                                                        
                                                        sf.ui.proTools.selectedTrack.trackScrollToView();
                                                        
                                                        //Close the Plugin Window if the CMD key is not held down
                                                        if (!event.keyboardState.hasCommand) {
                                                        
                                                            // Close plugin window, if window has not title(inactive plug-in) close it instead
                                                            try {
                                                                sf.ui.proTools.windows.whoseTitle.startsWith("Plug-in: ").first.windowClose();
                                                            } catch (err) {
                                                                // do nothing
                                                                sf.ui.proTools.windows.whoseTitle.is("").first.getElement("AXCloseButton").elementClick();
                                                            }
                                                        }
                                                        
                                                        // Select "no insert" from open plugin window's insert selector
                                                        try {
                                                            sf.ui.proTools.selectedTrack.insertSelectorButtons[slotLetters.lastIndexOf(slot)].popupMenuSelect({
                                                                menuPath: ["no insert"],
                                                            });
                                                        } catch (err) {
                                                            log("Cannot click insert selector popup - be sure inserts are visible and not obscured by another window")
                                                        };
                                                        
                                                        Reply1 LikeSolution
                                                        1. DDaniel Holsinger @Daniel_Holsinger
                                                            2022-05-17 22:16:12.027Z

                                                            That worked but it seems almost like it would take the same time to click and remove it. The inactive plugin window has to be open to allow the script to work.

                                                            What could make it streamlined is if it could search through the selected channel and then remove all inactive plugins. Longer script I'm sure. But I could see a use for that in cleaning up sessions. Especially if you could highlight all the tracks in a session and then remove all inactive plugins....?

                                                            1. DDaniel Holsinger @Daniel_Holsinger
                                                                2022-05-17 22:34:47.593Z

                                                                I realised that this works for both active and inactive which is still very useful. I see at times you may just make it inactive and then move on. If you come back to it then yes you can just select it and remove it.

                                                                1. Ben Rubin @Ben_Rubin
                                                                    2022-05-18 13:44:21.679Z

                                                                    I found this script somewhere that clears all inactive inserts:

                                                                    function dismissDialg() {
                                                                        if (sf.ui.proTools.confirmationDialog.invalidate().buttons.whoseTitle.is('Remove').first.exists) {
                                                                    
                                                                            sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is('Remove').first.elementClick();
                                                                    
                                                                            sf.ui.proTools.confirmationDialog.elementWaitFor({
                                                                                waitType: "Disappear",
                                                                            });
                                                                        }
                                                                        if (sf.ui.proTools.confirmationDialog.invalidate().buttons.whoseTitle.is('Change').first.exists) {
                                                                    
                                                                            sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is('Change').first.elementClick();
                                                                    
                                                                            sf.ui.proTools.confirmationDialog.elementWaitFor({
                                                                                waitType: "Disappear",
                                                                            });
                                                                        }
                                                                    }
                                                                    
                                                                    
                                                                    function removeInactive() {
                                                                    
                                                                        //remove inactive inserts
                                                                        for (var i = 0; i < 10; i++) {
                                                                    
                                                                            dismissDialg()
                                                                            if (sf.ui.proTools.selectedTrack.insertSelectorButtons[i].invalidate().value.value.startsWith("inactive")) {
                                                                                sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({
                                                                                    insertOrSend: "Insert",
                                                                                    pluginNumber: i + 1,
                                                                                    pluginPath: ['no insert']
                                                                                });
                                                                                dismissDialg()
                                                                            }
                                                                        }
                                                                    }
                                                                    
                                                                    function enableMenus(currentValue) {
                                                                        sf.ui.proTools.menuClick({
                                                                            menuPath: ["View", "Edit Window Views", currentValue],
                                                                            targetValue: "Enable"
                                                                        });
                                                                    }
                                                                    
                                                                    
                                                                    const menus = [
                                                                        "Inserts A-E",
                                                                        "Inserts F-J"
                                                                    ]
                                                                    
                                                                    
                                                                    //Activate Pro Tools
                                                                    sf.ui.proTools.appActivate();
                                                                    sf.ui.proTools.invalidate();
                                                                    
                                                                    //Enable view of Inserts and Sends
                                                                    menus.forEach(enableMenus)
                                                                    
                                                                    sf.ui.proTools.invalidate();
                                                                    
                                                                    //Get selected tracks
                                                                    const originalTracks = sf.ui.proTools.selectedTrackNames;
                                                                    
                                                                    //Do for each track.
                                                                    sf.ui.proTools.selectedTracks.trackHeaders.slice().map(track => {
                                                                    
                                                                        //Select track
                                                                        track.trackSelect();
                                                                    
                                                                        //Scroll track into View
                                                                        track.trackScrollToView();
                                                                    
                                                                        removeInactive()
                                                                    
                                                                    });
                                                                    
                                                                    //Restore previously selected tracks
                                                                    sf.ui.proTools.trackSelectByName({ names: originalTracks });
                                                                    1. DDaniel Holsinger @Daniel_Holsinger
                                                                        2022-05-18 14:30:47.462Z

                                                                        i'll try this out

                                                                        1. In reply toBen_Rubin:
                                                                          DDaniel Holsinger @Daniel_Holsinger
                                                                            2022-05-18 14:44:22.790Z

                                                                            So you have to highlight the area to want the script to run. Be cool if you could also allocate a pre-ordained area eg. from track "Kick" to track "Vocal" if that makes sense.

                                                                            1. Ben Rubin @Ben_Rubin
                                                                                2022-05-18 15:44:59.546Z

                                                                                yeah, it works on the selected tracks. I'm sure it would easy to modify by someone with coding ability!

                                                                    2. Ben Rubin @Ben_Rubin
                                                                        2022-05-18 02:48:09.461Z

                                                                        I'm sure I grabbed that code from somewhere on this forum. I'm a cut-and-paster.

                                                                2. Ben Rubin @Ben_Rubin
                                                                    2022-05-18 13:57:33.902Z

                                                                    Here's my latest version, I've added: Switch from Mix Window to Edit Window and then back at the end, make sure track height is small or greater (and then return to original height):

                                                                    sf.ui.proTools.appActivateMainWindow();
                                                                    
                                                                    // Remember original Window:
                                                                    
                                                                    // #1
                                                                    function mainWindowStatus() {
                                                                        if (sf.ui.proTools.getMenuItem('Window', 'Mix').isMenuChecked) {
                                                                            sf.ui.proTools.menuClick({
                                                                                menuPath: ["Window", "Edit"],
                                                                            });
                                                                            return "Mix";
                                                                        } else {
                                                                            return "Edit";
                                                                        }
                                                                    }
                                                                    
                                                                    //#2
                                                                    function returnToStartingMainWIndow(mainWindow) {
                                                                        if (mainWindow == "Mix") {
                                                                            sf.ui.proTools.menuClick({
                                                                                menuPath: ["Window", "Mix"],
                                                                            });
                                                                        }
                                                                    }
                                                                    
                                                                    let startingWindow = mainWindowStatus();
                                                                    
                                                                    const slotLetters = "abcdefghij"
                                                                    
                                                                    // Get focused plugin window
                                                                    var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitleStartingWith("Plug-in").invalidate();
                                                                    
                                                                    // Check if plugin window is an inactive Plugin and get its info
                                                                    if (!frontPluginWin.hasLiveValidUI) {
                                                                        var frontPluginWin = sf.ui.proTools.getFloatingWindowWithTitle("");
                                                                    };
                                                                    
                                                                    // Check if a plugin window is open then get plugin slot and track name from it
                                                                    if (frontPluginWin) {
                                                                        try {
                                                                            var slot = frontPluginWin.popupButtons.whoseTitle.is("Insert Position selector").first.value.invalidate().value;
                                                                            var pluginTrack = frontPluginWin.popupButtons.whoseTitle.is("Track Selector").first.value.invalidate().value
                                                                    
                                                                            /* if error then no plugin window is open */
                                                                        } catch (err) {
                                                                            log("Remove Plugin", "To remove plug-in, open plugin in that slot");
                                                                            throw 0
                                                                        };
                                                                    };
                                                                    
                                                                    // Select plugin's track and scroll into view
                                                                    sf.ui.proTools.trackSelectByName({ names: [pluginTrack] });
                                                                    
                                                                    sf.ui.proTools.selectedTrack.trackScrollToView();
                                                                    
                                                                    function getCurrentTrackHeight(h) {
                                                                    
                                                                        let originalTrackHeight;
                                                                        let isTrackTooSmall = (h <= 43) ? true : false;
                                                                    
                                                                        //this is all likely tied to screen resolution, highDPI etc
                                                                        switch (true) {
                                                                            case (h <= 16):
                                                                                originalTrackHeight = 'micro';
                                                                                break;
                                                                            case (h === 23):
                                                                                originalTrackHeight = 'mini';
                                                                                break;
                                                                            case (h === 43):
                                                                                originalTrackHeight = 'small';
                                                                                break;
                                                                            case (h === 97):
                                                                                originalTrackHeight = 'medium';
                                                                                break;
                                                                            case (h === 192):
                                                                                originalTrackHeight = 'large';
                                                                                break;
                                                                            case (h === 300):
                                                                                originalTrackHeight = 'jumbo';
                                                                                break;
                                                                            case (h > 300):
                                                                                originalTrackHeight = 'extreme';
                                                                                break;
                                                                        }
                                                                        return { originalTrackHeight, isTrackTooSmall }
                                                                    }
                                                                    
                                                                    function setTrackSize(size) {
                                                                        const f = sf.ui.proTools.selectedTrack.frame;
                                                                        let popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
                                                                            relativePosition: { x: f.w - 10, y: 5 },
                                                                            isOption: true,
                                                                            isShift: true,
                                                                        }).popupMenu;
                                                                        popupMenu.menuClickPopupMenu({
                                                                            menuPath: [size]
                                                                        });
                                                                    }
                                                                    
                                                                    //get the height of the target track
                                                                    const selectedTrackHeight = sf.ui.proTools.selectedTrack.frame.h;
                                                                    
                                                                    //get original track height and if it's too small
                                                                    let { originalTrackHeight, isTrackTooSmall } = getCurrentTrackHeight(selectedTrackHeight);
                                                                    
                                                                    //resize track if necessary
                                                                    if (isTrackTooSmall) setTrackSize("small");
                                                                    
                                                                    //Close the Plugin Window if the CMD key is not held down
                                                                    if (!event.keyboardState.hasCommand) {
                                                                    
                                                                        // Close plugin window, if window has not title(inactive plug-in) close it instead
                                                                        try {
                                                                            sf.ui.proTools.windows.whoseTitle.startsWith("Plug-in: ").first.windowClose();
                                                                        } catch (err) {
                                                                            // do nothing
                                                                            sf.ui.proTools.windows.whoseTitle.is("").first.getElement("AXCloseButton").elementClick();
                                                                        }
                                                                    }
                                                                    
                                                                    // Select "no insert from open plugin window's insert selector
                                                                    try {
                                                                        sf.ui.proTools.selectedTrack.insertSelectorButtons[slotLetters.lastIndexOf(slot)].popupMenuSelect({
                                                                            menuPath: ["no insert"],
                                                                        });
                                                                    } catch (err) {
                                                                        log("Cannot click insert selector popup - be sure inserts are visible and not obscured by another window")
                                                                    };
                                                                    
                                                                    //if track height changed to access the popup menu, change it back to what it was
                                                                    if (isTrackTooSmall) setTrackSize(originalTrackHeight);
                                                                    
                                                                    sf.ui.proTools.selectedTrack.trackScrollToView();
                                                                     
                                                                    // Switch back to Mix Window if necessary
                                                                    returnToStartingMainWIndow(startingWindow);
                                                                    

                                                                    Pretty sure @Chris_Shaw wrote most of this code so thanks, Chris!!!

                                                                    and btw I would love to have one that works natively in the Mix Window too.

                                                                    1. DDaniel Holsinger @Daniel_Holsinger
                                                                        2022-05-18 14:09:01.388Z

                                                                        why does it need to be small or greater?

                                                                        1. Ben Rubin @Ben_Rubin
                                                                            2022-05-18 14:16:20.871Z

                                                                            i was having issues where if the track height was smaller than "small" the script would fail.