iZotope RX Plug-in Script - help
Hi @chrscheuer,
I need a hand with ironing out an issue in my iZotope RX 7 Script used for De-essing & Taming prominent frequencies in a selected area.
The processing workflow is as follows
- User selects the audio area to be processed
- User runs the script
- If the Plug-in Module is not open, the script opens it and terminates the script... If the Plug-in Module is open the script continues with the preceding steps
- The script then selects a plugin preset "SOOTHE2"
- The script assigns values to the nodes in Soothe2 Plugin preset (based on audio selection)
- The script then processes the new Plug-in Module settings.
I have it working some of the time as seen here;
But when I change the Plug-in Module preset and re-trigger the script, it (sometimes - most of the time) gets stuck in a loop trying to find the preset name "SOOTHE2" but never acknowledges it as it is in focus.
The only way I can make it stop scrolling through the presets is by canceling the script of selecting "Reload Presets" from the Plug-in menu dropdown.
Any insight into what might be stopping it from working all the time would be great.
I think the issue may be in the following function, but I may be wrong;
function selectPluginPreset(name) {
var btn = sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In Header Background').first.popupButtons.whoseTitle.is('Presets').first;
if (btn.value.invalidate().value == name) return;
btn.elementClick();
sf.keyboard.press({ keys: 'enter', fast: true });
while (true) {
sf.engine.checkForCancellation();
if (btn.value.invalidate().value == name) break;
sf.keyboard.press({ keys: 'down' });
}
}
Here is the issue in action.
If only it was easier to select popup menu items and dropdown menu's in iZotope RX 7!
The full script is as follows;
function ensurePluginWindowIsOpen() {
var win = sf.ui.izotope.windows.whoseTitle.is('Plug-in').first;
if (!win.exists) {
sf.ui.izotope.menuClick({
menuPath: ['Modules', 'Plug-in', 'None']
});
win.elementWaitFor();
sf.wait({intervalMs:200});
}
}
function selectPluginPreset(name) {
var btn = sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In Header Background').first.popupButtons.whoseTitle.is('Presets').first;
if (btn.value.invalidate().value == name) return;
btn.elementClick();
sf.keyboard.press({ keys: 'enter', fast: true });
while (true) {
sf.engine.checkForCancellation();
if (btn.value.invalidate().value == name) break;
sf.keyboard.press({ keys: 'down' });
}
}
function refreshPluginPreset() {
var btn = sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In Header Background').first.popupButtons.whoseTitle.is('Presets').first;
btn.elementClick();
sf.keyboard.press({ keys: 'return', fast: true });
}
function processOpenPluginPreset() {
var btn = sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In Footer Background').first.buttons.whoseDescription.is('Apply').first;
btn.elementClick();
}
function setSootheSettings() {
//Grab Low and High Frequencies
var win = sf.ui.izotope.mainWindow.groups.whoseDescription.is('RX7 Main Window').first.groups.whoseDescription.is('App Footer').first.groups.whoseDescription.is('Editor Selection Panel').first;
var frequencySelectionLow = win.buttons.whoseDescription.is('Selection starting frequency').first.value.value;
var frequencySelectionHigh = win.buttons.whoseDescription.is('Selection ending frequency').first.value.value;
//Check to see if the lowest and higest frequencies are withing 20-20000kHz
if (Number(frequencySelectionLow) < 20) { var frequencySelectionLow = '20' };
if (Number(frequencySelectionHigh) > 19999.99) { var frequencySelectionHigh = '19999.99' };
//Find The frequency Selection Center
var frequencySelectionCenter = Math.sqrt(Number(frequencySelectionHigh) * Number(frequencySelectionLow));
//Soothe2 window abreviation
var pluginWindow = sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In');
//Raise Plugin Window
sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.elementRaise();
sf.wait({ intervalMs: 50 });
//Soothe node 1 click click and set
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 415, "y": 354 } });
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 489, "y": 617 } });
sf.keyboard.type({ text: String(frequencySelectionLow), });
sf.keyboard.press({ keys: "return", fast: true });
//Soothe node 2 click click and set
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 474, "y": 194 } });
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 489, "y": 617 } });
sf.keyboard.type({ text: String(frequencySelectionCenter), });
sf.keyboard.press({ keys: "return", fast: true });
//Soothe node 3 click click and set
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 572, "y": 194 } });
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 489, "y": 617 } });
sf.keyboard.type({ text: String(frequencySelectionCenter), });
sf.keyboard.press({ keys: "return", fast: true });
//Soothe node 4 click click and set
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 657, "y": 194 } });
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 489, "y": 617 } });
sf.keyboard.type({ text: String(frequencySelectionCenter), });
sf.keyboard.press({ keys: "return", fast: true });
//Soothe node 5 click click and set
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 753, "y": 194 } });
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 489, "y": 617 } });
sf.keyboard.type({ text: String(frequencySelectionCenter), });
sf.keyboard.press({ keys: "return", fast: true });
//Soothe node 5 click click and set
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 850, "y": 354 } });
pluginWindow.first.mouseClickElement({ relativePosition: { "x": 489, "y": 617 } });
sf.keyboard.type({ text: String(frequencySelectionHigh), });
sf.keyboard.press({ keys: "return", fast: true });
}
//All FUNCTIONS ABOVE THIS LINE
if (!sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.exists) {
sf.ui.izotope.menuClick({
menuPath: ['Modules', 'Plug-in', 'None']
});
selectPluginPreset('SOOTHE2');
throw (0);
};
function processPluginModuleChain(name) {
sf.ui.izotope.invalidate();
sf.ui.izotope.appActivateMainWindow();
ensurePluginWindowIsOpen();
refreshPluginPreset();
selectPluginPreset('SOOTHE2');
setSootheSettings();
processOpenPluginPreset();
}
processPluginModuleChain('SOOTHE2');
Thanks in advance legend!
Kitch
- Christian Scheuer @chrscheuer2020-02-16 03:37:38.308Z
Hmm.. yea this interaction is by far the most fragile part of the current iZotope integration.
I had issues with this as well.Try
function selectPluginPreset(name) { var btn = sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In Header Background').first.popupButtons.whoseTitle.is('Presets').first; if (btn.value.invalidate().value == name) return; btn.mouseClickElement(); sf.keyboard.press({ keys: 'enter', fast: true }); while (true) { sf.engine.checkForCancellation(); if (btn.value.invalidate().value == name) break; sf.keyboard.press({ keys: 'down' }); } }
Kitch Membery @Kitch2020-02-16 04:07:19.489Z
Thanks mate. Will check it late tonight. :-)
- In reply tochrscheuer⬆:
Kitch Membery @Kitch2020-03-21 10:23:44.201Z
Hi Christian... I finaly got the plug-in selection function working. :-)
function selectPluginPreset(name) { var pluginWindow = sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In'); var btn = pluginWindow.first.groups.whoseDescription.is('EffectPanel Plug-In Header Background').first.popupButtons.first; while (btn.value.invalidate().value !== name) { sf.engine.checkForCancellation(); sf.keyboard.press({ keys: 'down', fast: true }); btn.value.invalidate(); btn.mouseClickElement(); }; } selectPluginPreset('Preset Name Here');
Christian Scheuer @chrscheuer2020-03-21 10:27:18.979Z
Awesome!!
- In reply tochrscheuer⬆:
Kitch Membery @Kitch2020-03-21 10:37:47.583Z
And this script... (which needs some cleaning up) avoids having to scroll through each preset before finding the preset I want to select.
//Activate iZotope RX sf.ui.izotope.appActivateMainWindow(); //Wait for "Plug-in" window sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.elementWaitFor(); //Preset Name (Enter the preset you want to open here) var presetToSelect = 'Your Preset Here'; //iZotope RX Plugin Presets Folder (In the finder) var presetFilesPath = '~/Documents/iZotope/RX 7 Audio Editor/Presets/Plugin Host/' //Create an array of presets from iZotope RX Plugin presets folder var presetFilesArray = sf.file.directoryGetFiles({ path: presetFilesPath }).paths.filter(x => x.match('.xml')).map(x => x.split('/').slice(-1)[0].split('.').slice(0, -1).join('.')); //Sort presetFilesArray var presetFilesArraySorted = presetFilesArray.sort(); //Get the index number of the presetToSelect var presetToSelectIndex = presetFilesArraySorted.indexOf(presetToSelect); //Preset Name Button var btn = sf.ui.izotope.windows.whoseTitle.is('Plug-in').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In').first.groups.whoseDescription.is('EffectPanel Plug-In Header Background').first.popupButtons.first; var presetButtonValue = btn.value.invalidate().value; var presetFromButtonIndex = presetFilesArraySorted.indexOf(presetButtonValue); //find the distance between the "Preset From Button" and the "Preset to Select" var distanceFromPresetToSelect = presetToSelectIndex - presetFromButtonIndex; if (distanceFromPresetToSelect !== 0) { //Click Preset Button btn.mouseClickElement({ anchor: "MidCenter", }); if (distanceFromPresetToSelect < 0) { sf.keyboard.press({ keys: 'up', fast: true, repetitions: (distanceFromPresetToSelect * -1) }); } else { sf.keyboard.press({ keys: 'down', fast: true, repetitions: distanceFromPresetToSelect }); }; } //Activate preset sf.keyboard.press({ keys: "enter", });
With Jesper and your help I was able to create an array of presets from the iZotope preset folder and work out the distance between the currently selected preset and the desired preset. Then by using the up and down arrows I could use that number of repetitions to get to the preset I want.
So thanks again!
Daniel Perez @daniel_perez
having plugins activated in rx, slows and bugs down rx big time. i deactivated all plugins in rx. acon is much better at handling 3rd party plugins.