Bounce Mix - Select Multi Mix Sources
Title
Bounce Mix - Select Multi Mix Sources
What do you expect to happen when you run the script/macro?
This script opens up det Bounce window, ads 3 mix sources and selects the physical outputs: DX, FX and MX BED. It all works great.. But
Are you seeing an error?
What happens when you run this script?
If multible mix sources are selected when opening the window the script will just add more to the existing count.
Is there a way to detect the count? remove the sources in a smart way so that you dont get an error if the count is unkoown?
How were you running this script?
I clicked the "Run Script" or "Run Macro" button in SoundFlow
How important is this issue to you?
3
Details
{ "inputExpected": "This script opens up det Bounce window, ads 3 mix sources and selects the physical outputs: DX, FX and MX BED. \nIt all works great.. But\n", "inputIsError": false, "inputWhatHappens": "If multible mix sources are selected when opening the window the script will just add more to the existing count. \n\nIs there a way to detect the count? remove the sources in a smart way so that you dont get an error if the count is unkoown?", "inputHowRun": { "key": "-MpfwYA4I6GGlXgvp5j1", "title": "I clicked the \"Run Script\" or \"Run Macro\" button in SoundFlow" }, "inputImportance": 3, "inputTitle": "Bounce Mix - Select Multi Mix Sources" }
Source
sf.ui.proTools.appActivateMainWindow();
sf.ui.proTools.getMenuItem('File', 'Bounce Mix...').elementClick();
//Wait for 'Bounce Mix' window
let bounceWin = sf.ui.proTools.dialogWaitForManual({
dialogTitle: 'Bounce Mix'
}).dialog;
// CLICK TO ADD SOOURCES
const mixSourceButtonTitle = 'DX BED (7.1.2)';
const mixSourcePath = ["physical output", "DX BED (7.1.2)"];
const bounceDlg = sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first;
//Mix Source - Popup Menu
if (bounceDlg.popupButtons.allItems[1].value.invalidate().value !== mixSourceButtonTitle) {
bounceDlg.popupButtons.allItems[1].popupMenuSelect({
menuSelector: items => items.filter(item =>
item.path[0].endsWith(mixSourcePath[0]) &&
item.path[1].endsWith(mixSourcePath[1]))[0]
});
}
sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.buttons.whoseTitle.is("Add row").first.mouseClickElement({
anchor: "TopLeft",
});
const mixSourceButtonTitle = 'FX BED (7.1.2)';
const mixSourcePath = ["physical output", "FX BED (7.1.2)"];
const bounceDlg = sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first;
//Mix Source - Popup Menu
if (bounceDlg.popupButtons.allItems[2].value.invalidate().value !== mixSourceButtonTitle) {
bounceDlg.popupButtons.allItems[2].popupMenuSelect({
menuSelector: items => items.filter(item =>
item.path[0].endsWith(mixSourcePath[0]) &&
item.path[1].endsWith(mixSourcePath[1]))[0]
});
}
sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.buttons.whoseTitle.is("Add row").first.mouseClickElement({
anchor: "TopLeft",
});
const mixSourceButtonTitle = 'MX BED (7.1.2)';
const mixSourcePath = ["physical output", "MX BED (7.1.2)"];
const bounceDlg = sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first;
//Mix Source - Popup Menu
if (bounceDlg.popupButtons.allItems[3].value.invalidate().value !== mixSourceButtonTitle) {
bounceDlg.popupButtons.allItems[3].popupMenuSelect({
menuSelector: items => items.filter(item =>
item.path[0].endsWith(mixSourcePath[0]) &&
item.path[1].endsWith(mixSourcePath[1]))[0]
});
}
Links
User UID: QO1zQljHOKXAG1PpilXlugc9h0d2
Feedback Key: sffeedback:QO1zQljHOKXAG1PpilXlugc9h0d2:-NQVxXGIKLzqArBErbhx
- NNicolai Linck @Nicolai_Linck7
Anyone?
Chris Shaw @Chris_Shaw2023-03-30 19:08:21.389Z
I think the easiest way to do this would be to store the bounce window settings in one of the 1-5 preset buttons or or save the settings and select them from the top settings menu. Then just write a short script to select them
Chris Shaw @Chris_Shaw2023-03-30 19:10:51.731Z
or are you trying to add you bounce sources in addition to what may already be there?
- In reply toNicolai_Linck7⬆:Chris Shaw @Chris_Shaw2023-03-30 21:00:22.171Z2023-04-01 01:22:49.397Z
Try this:
This will add/delete the number of sources needed (determined by themixSources
array) then set all of the source popups.To use different sources just add or remove the paths in the
mixSources
array.
//CS////Paths to desired sources const mixSources = [ ["physical output", "DX BED (7.1.2)"], ["physical output", "FX BED (7.1.2)"], ["physical output", "MX BED (7.1.2)"], ]; sf.ui.proTools.appActivateMainWindow(); // Define Bounce Window const bounceWindow = sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first // Open bounce Window sf.ui.proTools.getMenuItem('File', 'Bounce Mix...').elementClick(); // Wait for Bounce Window bounceWindow.elementWaitFor() // Count the number of move row buttons // This will determine how many sources exist in the bounce window let existingSources = bounceWindow.buttons.whoseTitle.is("Move row").allItems.length; // If no Move Row buttons exist then there is only one existing source if (existingSources == 0) existingSources = 1 //Determine which button to press to add or remove sources (rows) const addOrRemove = existingSources < mixSources.length ? "Add " : "Remove " // Define button to press const addOrRemoveButton = bounceWindow.buttons.whoseTitle.is(addOrRemove + "row").first // Determine how many sources to add or delete // If number is negative (remove rows) then ensure resulting number is positive via Math.abs const addOrDeleteCount = Math.abs(mixSources.length - existingSources) // Add or remove rows addOrRemoveButton.mouseClickElement({ clickCount: addOrDeleteCount }); // Set bounce sources mixSources.forEach((path, index) => { bounceWindow.popupButtons.allItems[index + 1].popupMenuSelect({ menuPath: path }); })
Chris Shaw @Chris_Shaw2023-04-01 01:29:50.332Z
If this doesn't work then you'll probably have to use the menu filtering you have in your script. If that's the case, replace line 44 in my script with :
menuSelector: items => items.filter(item => item.path[0].endsWith(mixSourcePath[0]) && item.path[1].endsWith(mixSourcePath[1]))[0]
- NIn reply toNicolai_Linck7⬆:Nicolai Linck @Nicolai_Linck7
Hi Chris. I have been very busy so i haven't had time before now to try out your code. It works like a charm. Thank you!
- NNicolai Linck @Nicolai_Linck7
Hi again Chris.
Im having issues with line 48. The script is working well for the most parts, but its throwing an error saying:
Could not open popup menu (Bounce Video test Copy: Line 48)
Popup menu was not found
Popup window was not found after waiting 2000 ms
Sometimes its stopping on the first Mix Source, sometimes almost the last.The code is here:
//Paths to desired sources const mixSources = [ ["bus", "2.0 Master (Stereo)"], ["bus", "5.1 Master (5.1)"], ["bus", "Dia Stem 2.0 (Stereo)"], ["bus", "Dia Stem 5.1 (5.1)"], ["bus", "FX Stem 2.0 (Stereo)"], ["bus", "FX Stem 5.1 (5.1)"], ["bus", "Music Stem 2.0 (Stereo)"], ["bus", "Music Stem 5.1 (5.1)"], ]; sf.ui.proTools.appActivateMainWindow(); // Define Bounce Window const bounceWindow = sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first // Open bounce Window sf.ui.proTools.getMenuItem('File', 'Bounce Mix...').elementClick(); // Wait for Bounce Window bounceWindow.elementWaitFor() // Count the number of move row buttons // This will determine how many sources exist in the bounce window let existingSources = bounceWindow.buttons.whoseTitle.is("Move row").allItems.length; // If no Move Row buttons exist then there is only one existing source if (existingSources == 0) existingSources = 1 //Determine which button to press to add or remove sources (rows) const addOrRemove = existingSources < mixSources.length ? "Add " : "Remove " // Define button to press const addOrRemoveButton = bounceWindow.buttons.whoseTitle.is(addOrRemove + "row").first // Determine how many sources to add or delete // If number is negative (remove rows) then ensure resulting number is positive via Math.abs const addOrDeleteCount = Math.abs(mixSources.length - existingSources) // Add or remove rows addOrRemoveButton.mouseClickElement({ clickCount: addOrDeleteCount }); // Set bounce sources mixSources.forEach((path, index) => { bounceWindow.popupButtons.allItems[index + 1].popupMenuSelect({ menuPath: path }); })
Thanks in advance!!