Hey Everyone...
I understand that might be a rookie question, but I found a few scripts to help me automate the bounce to disk function in Pro Tools but I kind of got lost into it..
Im trying to get the file bounced to the native session folder "bounced files" in a sample rate of 24-48 with a mp3 version of it.
Any clues where I can find this one?
Thanks
Zeca Leme
Linked from:
- Kitch Membery @Kitch2020-11-03 22:48:22.997Z
Hi @BTG_Studio,
This should do what you are after;
function bounceToDisk(name) { sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce to', 'Disk...'] }); let bounceDlg = sf.ui.proTools.dialogWaitForManual({ dialogTitle: 'Bounce' }).dialog; const bounceCheckboxes = sf.ui.proTools.windows.whoseTitle.is('Bounce').first.checkBoxes; bounceCheckboxes.whoseTitle.is('Add MP3').first.checkboxSet({ targetValue: "Enable", }); let popupButtons = bounceDlg.getElements("AXChildren").filter(function (e) { return e.fullRole == "AXPopUpButton" }).slice(-4); let fileTypeBtn = popupButtons[0]; let formatBtn = popupButtons[1]; let bitDepthBtn = popupButtons[2]; let sampleRateBtn = popupButtons[3]; //File Type if (fileTypeBtn.value.invalidate().value != 'WAV') fileTypeBtn.popupMenuSelect({ menuPath: ['WAV'] }); //File Format if (formatBtn.value.value != "Interleaved") formatBtn.popupMenuSelect({ menuPath: ['Interleaved'] }); //Bit Depth if (bitDepthBtn.value.invalidate().value != '24 Bit') bitDepthBtn.popupMenuSelect({ menuPath: ['24 Bit'] }); //Sample Rate if (sampleRateBtn.value.invalidate().value != '44.1 kHz') sampleRateBtn.popupMenuSelect({ menuPath: ['44.1 kHz'] }); //File Name sf.ui.proTools.windows.whoseTitle.is('Bounce').first.textFields.whoseTitle.is('').first.elementSetTextFieldWithAreaValue({ value: name, }); //Media Composer Compatability bounceCheckboxes.whoseTitle.is('Enforce Media Composer Compatibility').first.checkboxSet({ targetValue: "Disable", }); //Import After Bounce bounceCheckboxes.whoseTitle.is('Import After Bounce').first.checkboxSet({ targetValue: "Disable", }); //Add to iTunes bounceCheckboxes.whoseTitle.is('Add To iTunes Library').first.checkboxSet({ targetValue: "Disable", }); //Offline Bounce bounceCheckboxes.whoseTitle.is('Offline').first.checkboxSet({ targetValue: "Enable", }); sf.ui.proTools.windows.whoseTitle.is('Bounce').first.buttons.whoseTitle.is('Bounce').first.elementClick(); sf.ui.proTools.windows.whoseTitle.is('MP3').first.elementWaitFor({ waitType: "Appear", }); sf.ui.proTools.windows.whoseTitle.is('MP3').first.buttons.whoseTitle.is('OK').first.elementClick(); } function main() { const bounceName = prompt("Enter bounce name."); if (bounceName == "null" || bounceName == null) { throw 0; } if (bounceName == "") { log('Cancelled', 'Please enter a valid page number'); throw 0; } bounceToDisk(bounceName); } main();
- BBTG Studio @BTG_Studio
Hi Kitch...
First of all, thanks for the quick help, Im new to sounflow community but already understood that people around here are very respectful and proactive.Well, the script did not work at first..
Had an issue at line 02 - but after another try it worked.One thing that I forgot to mention, and I could not find in the script is the Bource Source field. I am able to run the script and the bounced file shows at the folder, but its in silence. Which is probably because the source is not the correct one.
Thanks again for all the help
ZecaKitch Membery @Kitch2020-11-04 22:49:09.309Z
You are welcome Zeca!,
I'm not sure why there was an error with line 2, however let me know if it happens again.
As for the output assignment and bounce folder selection, I'll take a look at that tomorrow. :-)
K- BBTG Studio @BTG_Studio
Thanks Kitch..
Let me know when you have a chance to check it.Best
ZecaKitch Membery @Kitch2020-11-06 20:13:41.696Z
Hi Zeca,
This will get you most of the way there. It doesn't allow you to customize the settings for MP3 (That will take me a while to get sorted), but it does bounce an MP3 and as requested gives you the ability to assign an output and output path.
function setBouncePath(destination) { //Click on Choose to choose destination sf.ui.proTools.windows.whoseTitle.is('Bounce').first.buttons.whoseTitle.is('Choose...').first.elementClick(); //Get a reference to the focused window in the frontmost app: var win = sf.ui.frontmostApp.focusedWindow; //Open the Go to... sheet sf.keyboard.type({ text: '/' }); //Wait for the sheet to appear var sheet = win.sheets.first.elementWaitFor({ timeout: 500 }, 'Could not find "Go to" sheet in the Save/Open dialog').element; //Set the value of the combo box sheet.comboBoxes.first.value.value = destination; //Press OK sheet.buttons.whoseTitle.is('Go').first.elementClick({}, 'Could not click "Go"'); //Wait for sheet to close win.sheets.first.elementWaitFor({ waitForNoElement: true, timeout: 500 }, '"Go to" sheet didn\'t close in time'); //Click Open sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Open').first.elementClick(); } function bounceToDisk(name, path) { sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce to', 'Disk...'] }); let bounceDlg = sf.ui.proTools.dialogWaitForManual({ dialogTitle: 'Bounce' }).dialog; const bounceCheckboxes = sf.ui.proTools.windows.whoseTitle.is('Bounce').first.checkBoxes; bounceCheckboxes.whoseTitle.is('Add MP3').first.checkboxSet({ targetValue: "Enable", }); const popupButtons = bounceDlg.getElements("AXChildren").filter(function (e) { return e.fullRole == "AXPopUpButton" }).slice(-4); const fileTypeBtn = popupButtons[0]; const formatBtn = popupButtons[1]; const bitDepthBtn = popupButtons[2]; const sampleRateBtn = popupButtons[3]; //Physical Output path const outputPath = ["physical output", "MacBook Pro Speakers 1-2 (Stereo)"]; //Set Output if (sf.ui.proTools.windows.whoseTitle.is('Bounce').first.popupButtons.first.value.invalidate().value != outputPath.pop().split(' -> ').pop()) { sf.ui.proTools.windows.whoseTitle.is('Bounce').first.popupButtons.first.popupMenuSelect({ menuPath: outputPath, useWildcards: true, }); } //File Type if (fileTypeBtn.value.invalidate().value != 'WAV') fileTypeBtn.popupMenuSelect({ menuPath: ['WAV'] }); //File Format if (formatBtn.value.value != "Interleaved") formatBtn.popupMenuSelect({ menuPath: ['Interleaved'] }); //Bit Depth if (bitDepthBtn.value.invalidate().value != '24 Bit') bitDepthBtn.popupMenuSelect({ menuPath: ['24 Bit'] }); //Sample Rate if (sampleRateBtn.value.invalidate().value != '44.1 kHz') sampleRateBtn.popupMenuSelect({ menuPath: ['44.1 kHz'] }); //File Name sf.ui.proTools.windows.whoseTitle.is('Bounce').first.textFields.whoseTitle.is('').first.elementSetTextFieldWithAreaValue({ value: name, }); //Media Composer Compatability bounceCheckboxes.whoseTitle.is('Enforce Media Composer Compatibility').first.checkboxSet({ targetValue: "Disable", }); //Import After Bounce bounceCheckboxes.whoseTitle.is('Import After Bounce').first.checkboxSet({ targetValue: "Disable", }); //Add to iTunes bounceCheckboxes.whoseTitle.is('Add To iTunes Library').first.checkboxSet({ targetValue: "Disable", }); //Offline Bounce bounceCheckboxes.whoseTitle.is('Offline').first.checkboxSet({ targetValue: "Enable", }); setBouncePath(path); sf.ui.proTools.windows.whoseTitle.is('Bounce').first.buttons.whoseTitle.is('Bounce').first.elementClick(); sf.ui.proTools.windows.whoseTitle.is('MP3').first.elementWaitFor({ waitType: "Appear", }); sf.ui.proTools.windows.whoseTitle.is('MP3').first.buttons.whoseTitle.is('OK').first.elementClick(); } function main() { const destinationDirectory = '~/Desktop'; const bounceName = prompt("Enter bounce name."); if (bounceName == "null" || bounceName == null) { throw 0; } if (bounceName == "") { log('Cancelled', 'Please enter a valid page number'); throw 0; } bounceToDisk(bounceName, destinationDirectory); } main();
If I find time next week, I'll see if I can do some more work on this. :-)
Hope that helps.
Kitch
Kitch Membery @Kitch2020-11-06 20:18:22.258Z
In case I don't get around to updating the wav/mp3 Bounce command template soon, Here is a script that gets you most of the way there. :-)
I do plan on updating it though (it's on the list)!
- BBTG Studio @BTG_Studio
Hey Kitch...
Sorry to keep bothering you with that, but it didn't work again. Maybe I'm the one who's doing something wrong.. Does the script needs any fine tuning or edits from my end? Because I tried to just copy/past into SoundFlow and run the script from there, but still get errors.Thanks
Kitch Membery @Kitch2020-11-09 18:31:41.524Z
Hi @BTG_Studio,
No worries at all. What is the error message you are recieving?
This script need some slight modifications to get working. Specifically you'll need to update this line of code to reflect your bounce output path in Pro Tools.
//Physical Output path const outputPath = ["physical output", "MacBook Pro Speakers 1-2 (Stereo)"];
Let me know if you get stuck :-)
- BBTG Studio @BTG_Studio
Got it.. so I made the changes relative to my output from the script and got this error.
Thanks again Kitch.
Kitch Membery @Kitch2020-11-10 20:19:11.470Z2020-11-15 21:42:47.102Z
Ah yes... I have noticed some users are seeing this behavior. I think it is an OS specific issue
Here is an updated script that should hopefully fix it. Remember to adjust the output path... and let me know if it works for you. :-)
function setBouncePath(destination) { //Click on Choose to choose destination sf.ui.proTools.windows.whoseTitle.is('Bounce').first.buttons.whoseTitle.is('Choose...').first.elementClick(); //Get a reference to the focused window in the frontmost app: var win = sf.ui.frontmostApp.focusedWindow; //Open the Go to... sheet sf.keyboard.type({ text: '/' }); //Wait for the sheet to appear var sheet = win.sheets.first.elementWaitFor({ timeout: 500 }, 'Could not find "Go to" sheet in the Save/Open dialog').element; //Set the value of the combo box sheet.comboBoxes.first.value.value = destination; //Press OK sheet.buttons.whoseTitle.is('Go').first.elementClick({}, 'Could not click "Go"'); //Wait for sheet to close win.sheets.first.elementWaitFor({ waitForNoElement: true, timeout: 500 }, '"Go to" sheet didn\'t close in time'); //Click Open sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Open').first.elementClick(); } function bounceToDisk(name, path) { sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce to', 'Disk...'] }); let bounceDlg = sf.ui.proTools.dialogWaitForManual({ dialogTitle: 'Bounce' }).dialog; const bounceCheckboxes = sf.ui.proTools.windows.whoseTitle.is('Bounce').first.checkBoxes; bounceCheckboxes.whoseTitle.is('Add MP3').first.checkboxSet({ targetValue: "Enable", }); const popupButtons = bounceDlg.getElements("AXChildren").filter(function (e) { return e.fullRole == "AXPopUpButton" }).slice(-4); const fileTypeBtn = popupButtons[0]; const formatBtn = popupButtons[1]; const bitDepthBtn = popupButtons[2]; const sampleRateBtn = popupButtons[3]; //Physical Output path const outputPath = ["physical output", "Playback 1-2 (Stereo)"]; //Set Output if (sf.ui.proTools.windows.whoseTitle.is('Bounce').first.popupButtons.first.value.invalidate().value != outputPath.pop().split(' -> ').pop()) { sf.ui.proTools.windows.whoseTitle.is('Bounce').first.popupButtons.first.popupMenuSelect({ menuPath: outputPath, useWildcards: true, }); } //File Type if (fileTypeBtn.value.invalidate().value != 'WAV') fileTypeBtn.popupMenuSelect({ menuPath: ['WAV'] }); //File Format if (formatBtn.value.invalidate().value != "Interleaved") formatBtn.popupMenuSelect({ menuPath: ['Interleaved'] }); //Bit Depth if (bitDepthBtn.value.invalidate().value != '24 Bit') bitDepthBtn.popupMenuSelect({ menuPath: ['24 Bit'] }); //Sample Rate if (sampleRateBtn.value.invalidate().value != '44.1 kHz') sampleRateBtn.popupMenuSelect({ menuPath: ['44.1 kHz'] }); //File Name sf.ui.proTools.windows.whoseTitle.is('Bounce').first.textFields.whoseTitle.is('').first.elementSetTextFieldWithAreaValue({ value: name, }); //Media Composer Compatability bounceCheckboxes.whoseTitle.is('Enforce Media Composer Compatibility').first.checkboxSet({ targetValue: "Disable", }); //Import After Bounce bounceCheckboxes.whoseTitle.is('Import After Bounce').first.checkboxSet({ targetValue: "Disable", }); //Add to iTunes bounceCheckboxes.whoseTitle.is('Add To iTunes Library').first.checkboxSet({ targetValue: "Disable", }); //Offline Bounce bounceCheckboxes.whoseTitle.is('Offline').first.checkboxSet({ targetValue: "Enable", }); setBouncePath(path); sf.ui.proTools.windows.whoseTitle.is('Bounce').first.buttons.whoseTitle.is('Bounce').first.elementClick(); sf.ui.proTools.windows.whoseTitle.is('MP3').first.elementWaitFor({ waitType: "Appear", }); sf.ui.proTools.windows.whoseTitle.is('MP3').first.buttons.whoseTitle.is('OK').first.elementClick(); } function main() { const destinationDirectory = '~/Desktop'; const bounceName = prompt("Enter bounce name."); if (bounceName == "null" || bounceName == null) { throw 0; } if (bounceName == "") { log('Cancelled', 'Please enter a valid page number'); throw 0; } bounceToDisk(bounceName, destinationDirectory); } main();
- BBTG Studio @BTG_Studio
Hi Kitch.. still no. same error..
Just to be clear here, if I copy/paste the script to a new script , modify the physical output to the corresponding and hit "run macro"it should work right?
Thanks again for all the support...
samuel henriques @samuel_henriques
Hello @BTG_Studio try adding
sf.ui.proTools.appActivate();
tomain()
function like so:function main() { sf.ui.proTools.appActivate(); const destinationDirectory = '~/Desktop'; const bounceName = prompt("Enter bounce name."); if (bounceName == "null" || bounceName == null) { throw 0; } if (bounceName == "") { log('Cancelled', 'Please enter a valid page number'); throw 0; } bounceToDisk(bounceName, destinationDirectory); } main();
Or use with a trigger while pro tools is focused.
- BBTG Studio @BTG_Studio
Hey Samuel... Thanks for jumping in.
Now I got a different error..
I also assigned a keyboard trigger and ran the script from there.
Thankssamuel henriques @samuel_henriques
for me it works just by adding activate or having a trigger.
this is my line 63if (formatBtn.value.value != "Interleaved")
is it the same as yours?- BBTG Studio @BTG_Studio
same line 63 here
if (formatBtn.value.value != "Interleaved")
samuel henriques @samuel_henriques
the only way I think this error could happen is either the menu name is wrong (but works for me) or is not visible, for example pro tools not focused or bounce window is hidden. I bet @Kitch will figure this one.
sorry I couldn't help more- In reply toBTG_Studio⬆:
Kitch Membery @Kitch2020-11-12 00:16:04.168Z
@samuel_henriques, thanks so much for helping out!
@BTG_Studio, I think you found an error in my code. oops!
This line of code;
if (formatBtn.value.value != "Interleaved")
Should be changed to this;
if (formatBtn.value.invalidate().value != "Interleaved")
Let me know how that goes. :-)
- BBTG Studio @BTG_Studio
Hey @Kitch_Membery / @samuel_henriques ...
Thanks a lot for all the effort...it's almost there. Now with the last fix, I manage to bounce the file with the versions that I need... But they ended up at my desktop.as far as I could understand the code, the line 113 is supposed to be the "where the file should be"line
const destinationDirectory = '~/Desktop';
But the goal was to have it bounce at the bounced files folder, inside the session folder correspondence to the track bounced..Any hints how can I edit that ??
Thanks again for all the support
Best
Zecasamuel henriques @samuel_henriques
Hello @BTG_Studio, my pleasure,
try replacing:const destinationDirectory = '~/Desktop';
with:
const destinationDirectory = sf.ui.proTools.mainWindow.sessionPath.split('/').slice(0, -1).join('/') + '/Bounced Files';
- BBTG Studio @BTG_Studio
works great...
thanks @Kitch_Membery and @samuel_henriques
- BIn reply toBTG_Studio⬆:BTG Studio @BTG_Studio
Hey @Kitch_Membery @samuel_henriques.. me again..;-)
Sorry to bother you guys with this , but I just update my pro tools rig for the latest version and realize that the "Bounce To Mix"command is now renamed "Bounce Mix".
I tried to rename the script so it keeps going into this new version, but apparently I didn't do it correctly. Is that the only thing I should do?Thanks again
samuel henriques @samuel_henriques
hey @BTG_Studio,
can you post the exact script you are using? There are few updates thru the thread.- BBTG Studio @BTG_Studio
Hey @samuel_henriques ...
Here it is..function setBouncePath(destination) { //Click on Choose to choose destination sf.ui.proTools.windows.whoseTitle.is('Bounce').first.buttons.whoseTitle.is('Choose...').first.elementClick(); //Get a reference to the focused window in the frontmost app: var win = sf.ui.frontmostApp.focusedWindow; //Open the Go to... sheet sf.keyboard.type({ text: '/' }); //Wait for the sheet to appear var sheet = win.sheets.first.elementWaitFor({ timeout: 500 }, 'Could not find "Go to" sheet in the Save/Open dialog').element; //Set the value of the combo box sheet.comboBoxes.first.value.value = destination; //Press OK sheet.buttons.whoseTitle.is('Go').first.elementClick({}, 'Could not click "Go"'); //Wait for sheet to close win.sheets.first.elementWaitFor({ waitForNoElement: true, timeout: 500 }, '"Go to" sheet didn\'t close in time'); //Click Open sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Open').first.elementClick(); } function bounceToDisk(name, path) { sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce to', 'Disk...'] }); let bounceDlg = sf.ui.proTools.dialogWaitForManual({ dialogTitle: 'Bounce' }).dialog; const bounceCheckboxes = sf.ui.proTools.windows.whoseTitle.is('Bounce').first.checkBoxes; bounceCheckboxes.whoseTitle.is('Add MP3').first.checkboxSet({ targetValue: "Enable", }); const popupButtons = bounceDlg.getElements("AXChildren").filter(function (e) { return e.fullRole == "AXPopUpButton" }).slice(-4); const fileTypeBtn = popupButtons[0]; const formatBtn = popupButtons[1]; const bitDepthBtn = popupButtons[2]; const sampleRateBtn = popupButtons[3]; //Physical Output path const outputPath = ["physical output", "Out 23-24 (Stereo)"]; //Set Output if (sf.ui.proTools.windows.whoseTitle.is('Bounce').first.popupButtons.first.value.invalidate().value != outputPath.pop().split(' -> ').pop()) { sf.ui.proTools.windows.whoseTitle.is('Bounce').first.popupButtons.first.popupMenuSelect({ menuPath: outputPath, useWildcards: true, }); } //File Type if (fileTypeBtn.value.invalidate().value != 'WAV') fileTypeBtn.popupMenuSelect({ menuPath: ['WAV'] }); //File Format if (formatBtn.value.invalidate().value != "Interleaved") formatBtn.popupMenuSelect({ menuPath: ['Interleaved'] }); //Bit Depth if (bitDepthBtn.value.invalidate().value != '24 Bit') bitDepthBtn.popupMenuSelect({ menuPath: ['24 Bit'] }); //Sample Rate if (sampleRateBtn.value.invalidate().value != '44.1 kHz') sampleRateBtn.popupMenuSelect({ menuPath: ['44.1 kHz'] }); //File Name sf.ui.proTools.windows.whoseTitle.is('Bounce').first.textFields.whoseTitle.is('').first.elementSetTextFieldWithAreaValue({ value: name, }); //Media Composer Compatability bounceCheckboxes.whoseTitle.is('Enforce Media Composer Compatibility').first.checkboxSet({ targetValue: "Disable", }); //Import After Bounce bounceCheckboxes.whoseTitle.is('Import After Bounce').first.checkboxSet({ targetValue: "Disable", }); //Add to iTunes bounceCheckboxes.whoseTitle.is('Add To iTunes Library').first.checkboxSet({ targetValue: "Disable", }); //Offline Bounce bounceCheckboxes.whoseTitle.is('Offline').first.checkboxSet({ targetValue: "Enable", }); setBouncePath(path); sf.ui.proTools.windows.whoseTitle.is('Bounce').first.buttons.whoseTitle.is('Bounce').first.elementClick(); sf.ui.proTools.windows.whoseTitle.is('MP3').first.elementWaitFor({ waitType: "Appear", }); sf.ui.proTools.windows.whoseTitle.is('MP3').first.buttons.whoseTitle.is('OK').first.elementClick(); } function main() { sf.ui.proTools.appActivate(); const destinationDirectory = sf.ui.proTools.mainWindow.sessionPath.split('/').slice(0, -1).join('/') + '/Bounced Files'; const bounceName = prompt("Enter bounce name."); if (bounceName == "null" || bounceName == null) { throw 0; } if (bounceName == "") { log('Cancelled', 'Please enter a valid page number'); throw 0; } bounceToDisk(bounceName, destinationDirectory); } main`(`)`;`
- In reply toBTG_Studio⬆:
Kitch Membery @Kitch2020-12-22 01:54:17.105Z
Hi @BTG_Studio & @samuel_henriques,
Not a bother at all :-). In the latest version of Pro Tools, the "Bounce Mix" window has been changed a bit. I've added it to my to do list. I aim to get it sorted over the holidays... Will keep you posted.
Rock on!
- BBTG Studio @BTG_Studio
Thanks for the attention @Kitch_Membery and @samuel_henriques ...
Enjoy the Holidays and be safe.
Kitch Membery @Kitch2020-12-22 18:14:23.153Z
You too @BTG_Studio!! :-)
- In reply toBTG_Studio⬆:
samuel henriques @samuel_henriques
Hello guys, hope you enjoy your Holidays as much as possible.
This is working on my system, I tried to keep as much as possible from @Kitch 's script and added a the
function maximiseBounceWindow()
from another script Kitch and Chris Shaw were working on.I found a problem that I couldn't fix though, and It's weird and never happened to me before, it only happens if the mix source is not correct. If it is correct (meaning the script doesn't have to change it) there is no problem.
here:
//Physical Output path const outputPath = ["physical output", "Out 23-24 (Stereo)"]; //Set Output if (sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.popupButtons.allItems[1].value.invalidate().value != outputPath.pop().split(' -> ').pop()) { sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.popupButtons.allItems[1].popupMenuSelect({ menuPath: outputPath, useWildcards: true, }); }
I think something happens to the
const outputPath
but I couldn't figure out.
If it needs to be changed the script will stop like this, just like the picture. It's weird because it knows the path and navigates there, but doesn't do the last "click".Otherwise looks good. Maybe @Kitch will clean it a bit more, and make the bits I put my hands on, the proper way. :)
function maximiseBounceWindow() { const bounceWin = sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first; const audioPanel = bounceWin.groups.whoseTitle.is('Audio').first; function openAudioPanel() { if (audioPanel.buttons.whoseTitle.is('Collapser').exists) { audioPanel.buttons.whoseTitle.is('Collapser').first.elementClick(); } } const locationPanel = bounceWin.groups.whoseTitle.is('Location').first; function openLocationPanel() { if (locationPanel.buttons.whoseTitle.is('Collapser').exists) { locationPanel.buttons.whoseTitle.is('Collapser').first.elementClick(); } } switch (bounceWin.frame.h) { case 268: openAudioPanel(); openLocationPanel(); break; case 406: openLocationPanel(); break; case 393: openAudioPanel(); break; } } function bounceToDisk(name) { sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce Mix...'] }); let bounceDlg = sf.ui.proTools.dialogWaitForManual({ dialogTitle: 'Bounce Mix' }).dialog; maximiseBounceWindow() sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.textFields.first.elementSetTextFieldWithAreaValue({ value: name, }); const fileTypeBtn = sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.popupButtons.first //File Type if (fileTypeBtn.value.invalidate().value != 'WAV (BWF)') fileTypeBtn.popupMenuSelect({ menuPath: ['WAV (BWF)'] }); //Physical Output path const outputPath = ["physical output", "Out 23-24 (Stereo)"]; //Set Output if (sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.popupButtons.allItems[1].value.invalidate().value != outputPath.pop().split(' -> ').pop()) { sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.popupButtons.allItems[1].popupMenuSelect({ menuPath: outputPath, useWildcards: true, }); } ///Audio----------------------------////// // Enable MP3 sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.groups.whoseTitle.is('Audio').first.checkBoxes.first.checkboxSet({ targetValue: "Enable", }); const popupButtons = bounceDlg.groups.whoseTitle.is('Audio').first.getElements("AXChildren").filter(function (e) { return e.fullRole == "AXPopUpButton" }).slice(-4); const formatBtn = popupButtons[1]; const bitDepthBtn = popupButtons[2]; const sampleRateBtn = popupButtons[3]; //File Format if (formatBtn.value.invalidate().value != "Interleaved") formatBtn.popupMenuSelect({ menuPath: ['Interleaved'] }); //Bit Depth if (bitDepthBtn.value.invalidate().value != '24 Bit') bitDepthBtn.popupMenuSelect({ menuPath: ['24 Bit'] }); //Sample Rate if (sampleRateBtn.value.invalidate().value != '44.1 kHz') sampleRateBtn.popupMenuSelect({ menuPath: ['44.1 kHz'] }); ///Location----------------------------////// const locationbtn = sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.groups.whoseTitle.is('Location').first //Import After Bounce locationbtn.checkBoxes.first.checkboxSet({ targetValue: "Disable", }); //Select Set Session Folder locationbtn.radioButtons.first.checkboxSet({ targetValue: "Enable", }); //Set Session Folder locationbtn.textFields.first.elementSetTextFieldWithAreaValue({ value: "Bounced Files/", }); //Offline sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.checkBoxes.first.checkboxSet({ targetValue: "Enable", }); sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first.buttons.whoseTitle.is('Bounce').first.elementClick(); sf.ui.proTools.windows.whoseTitle.is('MP3').first.elementWaitFor({ waitType: "Appear", }); sf.ui.proTools.windows.whoseTitle.is('MP3').first.buttons.whoseTitle.is('OK').first.elementClick(); } function main() { sf.ui.proTools.appActivate(); const bounceName = prompt("Enter bounce name."); if (bounceName == "null" || bounceName == null) { throw 0; } if (bounceName == "") { log('Cancelled', 'Please enter a valid page number'); throw 0; } bounceToDisk(bounceName); } main();
Kitch Membery @Kitch2020-12-23 00:39:58.304Z
I think the issue you may be seeing is the first error of many to show up when running the script, as the window has been redesigned and is sectioned into panels. I promise I'll get to it over the break and let you know. Your implementation of adding the
maximiseBounceWindow()
is spot on though :-)Rock on!
samuel henriques @samuel_henriques
Hey Kitch, I've changed everything on the script I posted to suit the new window, only that popup is having a weird behaviour.
The rest works fine on my machineKitch Membery @Kitch2020-12-23 07:30:25.381Z
Hmmm,
I might have been overthinking it... give me a moment I'll check it out.
- In reply tosamuel_henriques⬆:
Kitch Membery @Kitch2020-12-23 07:35:25.112Z
You are correct... Should be an easy fix stand by :-)
samuel henriques @samuel_henriques
There's no hurry on this, go on to your deserved Holidays. Taking out the if will do fine so @BTG_Studio can use it for now.
- In reply tosamuel_henriques⬆:
Kitch Membery @Kitch2020-12-23 08:17:30.771Z2021-01-18 09:36:24.891Z
All right legends... It may need a little more tweaking (there are a few elements missing but here ya go :-)
I have not gone through and checked to see if each element is being addressed correctly but it seems to be working now. Wooohoooo... Happy Holidays @samuel_henriques & @BTG_Studio!
UPDATE: I did some refactoring and found the output popup menu fix was only working some of the time and I had to resort to using a "return" keypress to select the output. It seems to be working well but I plan on finding a more stable solution for it.
function maximiseBounceWindow() { const bounceWin = sf.ui.proTools.windows.whoseTitle.is('Bounce Mix').first; bounceWin.groups.forEach(g => { if (g.frame.h === 22) { if (g.buttons.whoseTitle.is('Collapser').first.exists) { g.buttons.whoseTitle.is('Collapser').first.elementClick(); } } }) } function bounceToDisk(bounceName) { //Open 'Bounce Mix' window sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce Mix...'] }); //Wait for 'Bounce Mix' window let bounceWin = sf.ui.proTools.dialogWaitForManual({ dialogTitle: 'Bounce Mix' }).dialog; //Maximise 'Bounce Mix' Window maximiseBounceWindow(); //Set Bounce Name bounceWin.textFields.first.elementSetTextFieldWithAreaValue({ value: bounceName, }); //Set File Type if (bounceWin.popupButtons.first.value.invalidate().value != 'WAV (BWF)') bounceWin.popupButtons.first.popupMenuSelect({ menuPath: ['WAV (BWF)'] }); //Output path const outputPath = ["physical output", "MacBook Pro Speakers 1-2 (Stereo)"]; const outputName = outputPath.pop(); //Set Output Path if (bounceWin.popupButtons.allItems[1].value.invalidate().value !== outputName) { const outputPopupMenu = bounceWin.popupButtons.allItems[1].popupMenuOpenFromElement().popupMenu; outputPopupMenu.menuClickPopupMenu({ menuPath: outputPath, }); sf.keyboard.press({ keys: 'return' }); } //AUDIO PANEL// const audioPanel = bounceWin.groups.whoseTitle.is('Audio').first; //Enable MP3 audioPanel.checkBoxes.whoseTitle.is('Add MP3').first.checkboxSet({ targetValue: 'Enable' }); //Popup Buttons const popupButtons = audioPanel.children.filter(e => e.fullRole == "AXPopUpButton").slice(-4); const compressionType = popupButtons[0]; const formatBtn = popupButtons[1]; const bitDepthBtn = popupButtons[2]; const sampleRateBtn = popupButtons[3]; //Compression Type if (compressionType.value.invalidate().value != 'PCM (Uncompressed)') compressionType.popupMenuSelect({ menuPath: ['PCM (Uncompressed)'] }); //File Format if (formatBtn.value.invalidate().value != 'Interleaved') formatBtn.popupMenuSelect({ menuPath: ['Interleaved'] }); //Bit Depth if (bitDepthBtn.value.invalidate().value != '24 Bit') bitDepthBtn.popupMenuSelect({ menuPath: ['24 Bit'] }); //Sample Rate if (sampleRateBtn.value.invalidate().value != '44.1 kHz') sampleRateBtn.popupMenuSelect({ menuPath: ['44.1 kHz'] }); //LOCATION PANEL// const locationPanel = bounceWin.groups.whoseTitle.is('Location').first //Import After Bounce locationPanel.checkBoxes.first.checkboxSet({ targetValue: "Disable", }); //Select Set Session Folder locationPanel.radioButtons.first.checkboxSet({ targetValue: "Enable", }); //Set Session Folder locationPanel.textFields.first.elementSetTextFieldWithAreaValue({ value: "Bounced Files/", }); //Offline bounceWin.checkBoxes.first.checkboxSet({ targetValue: "Enable", }); //Click Bounce bounceWin.buttons.whoseTitle.is('Bounce').first.elementClick(); //Wait for MP3 window const mp3Win = sf.ui.proTools.windows.whoseTitle.is('MP3').first.elementWaitFor({ pollingInterval: 50, timeout: 500, onError: 'Continue', }).element; //Click OK on MP3 window if (mp3Win.exists) { mp3Win.buttons.whoseTitle.is('OK').first.elementClick(); } } function main() { sf.ui.proTools.appActivate(); sf.ui.proTools.invalidate(); const bounceName = prompt("Enter bounce name."); if (bounceName == "null" || bounceName == null) { throw 0; } if (bounceName == "") { log('Cancelled', 'Please enter a valid page number'); throw 0; } bounceToDisk(bounceName); } main();
Updated 01/18/2021
- BBTG Studio @BTG_Studio
Hey @Kitch and @samuel_henriques ... Thanks again for the update. Works like a charm.
Have a great 2021!samuel henriques @samuel_henriques
Awesome, great year for you too!!