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
- Ben Rubin @Ben_Rubin
Find the package, "Scheps Move Inserts" in the store. It can do that.
- DDaniel Holsinger @Daniel_Holsinger
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.
- In reply toDaniel_Holsinger⬆:Chris Shaw @Chris_Shaw2022-05-17 19:13:54.399Z
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") };
- DDaniel Holsinger @Daniel_Holsinger
You Legend!!!! This is amazing. Worked perfectly. This works perfectly as described mate!
- In reply toChris_Shaw⬆:
Chris Shaw @Chris_Shaw2022-05-17 19:19:25.634Z
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 .
- DDaniel Holsinger @Daniel_Holsinger
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.
- In reply toChris_Shaw⬆:DDaniel Holsinger @Daniel_Holsinger
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();
- DDaniel Holsinger @Daniel_Holsinger
The only issue is it closes all temporary floating windows. Need to find a solution. I'll keep working on it.
- In reply toChris_Shaw⬆:
Ben Rubin @Ben_Rubin
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(); }
- DDaniel Holsinger @Daniel_Holsinger
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();
- In reply toBen_Rubin⬆:
Chris Shaw @Chris_Shaw2022-05-17 19:40:14.434Z
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).Chris Shaw @Chris_Shaw2022-05-17 19:42:07.831Z
I'm a bit busy now but I should add some code to clear a slot if the plugin is inactive.
Chris Shaw @Chris_Shaw2022-05-17 19:42:32.699Z
Which would be handy for tidying up a session.
- In reply toChris_Shaw⬆:DDaniel Holsinger @Daniel_Holsinger
yes it failed for me as well
- In reply toBen_Rubin⬆:DDaniel Holsinger @Daniel_Holsinger
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(); }
- DDaniel Holsinger @Daniel_Holsinger
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.
Chris Shaw @Chris_Shaw2022-05-17 21:28:14.195Z
I could make it to work in the mix window but it's a MUCH bigger script
- DDaniel Holsinger @Daniel_Holsinger
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
Chris Shaw @Chris_Shaw2022-05-17 22:00:04.461Z
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") };
- DDaniel Holsinger @Daniel_Holsinger
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....?
- DDaniel Holsinger @Daniel_Holsinger
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.
- In reply toDaniel_Holsinger⬆:
Ben Rubin @Ben_Rubin
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 });
- DDaniel Holsinger @Daniel_Holsinger
i'll try this out
- In reply toBen_Rubin⬆:DDaniel Holsinger @Daniel_Holsinger
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.
Ben Rubin @Ben_Rubin
yeah, it works on the selected tracks. I'm sure it would easy to modify by someone with coding ability!
- In reply toDaniel_Holsinger⬆:
Ben Rubin @Ben_Rubin
I'm sure I grabbed that code from somewhere on this forum. I'm a cut-and-paster.
- In reply toDaniel_Holsinger⬆:Ben Rubin @Ben_Rubin
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.
- DDaniel Holsinger @Daniel_Holsinger
why does it need to be small or greater?
Ben Rubin @Ben_Rubin
i was having issues where if the track height was smaller than "small" the script would fail.