Create stereo aux and insert plugin on the first insert slot of that new track
Desired Workflow
Create new stereo aux track with name "RX Mon" -> insert the RX 8 Monitor plugin on the first insert slot -> solo isolate the track
Question
The code seems to work, but there are times when it doesn't work. Not really sure what I am doing wrong here so it would be great if there is a way to improve the code so that it doesn't fail.
Command Info
ID: user:default:ckgaxrnhz00037h10ro7oewjf
Name: RX
Source
sf.ui.proTools.menuClick({
menuPath: ["Track", "New..."],
});
sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.elementWaitFor();
sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.popupButtons.whoseDescription.is('Track format').first.popupMenuSelect({
menuPath: ["Stereo"],
});
sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.popupButtons.whoseDescription.is('Track type').first.popupMenuSelect({
menuPath: ["Aux Input"],
});
sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.textFields.whoseTitle.is('Track Name').first.elementSetTextFieldWithAreaValue({
value: "RX Mon",
});
sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.buttons.whoseTitle.is('Create').first.elementClick();
sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.elementWaitFor({
waitType: "Disappear",
});
function getFirstFreeInsertIndex() {
var btns = sf.ui.proTools.selectedTrack.invalidate().insertButtons;
for (var i = 0; i < 10; i++)
if (btns[i].value.invalidate().value === "unassigned") return i;
return -1;
}
sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({
insertOrSend: 'Insert',
pluginNumber: getFirstFreeInsertIndex() + 1,
pluginPath: ['multichannel plug-in', 'Instrument', 'RX 8 Monitor (stereo)']
});
sf.ui.proTools.selectedTrack.buttons.whoseTitle.is('Solo').first.mouseClickElement({
isCommand: true,
});
Links
User UID: 4gVpNlUCeQYlTj0vqhBFQMDWkBz2
Feedback Key: sffeedback:4gVpNlUCeQYlTj0vqhBFQMDWkBz2:-MJhN8pYc0dDLREF85fu
Raphael Sepulveda @raphaelsepulveda2020-10-15 18:25:43.630ZHi Sam,
I would actually suggest that you make a track preset within Pro Tools of the RX Mon aux track and then use SoundFlow to create it, instead of putting it together from scratch every time. It’ll run faster and be less error prone.
Let me know if that makes sense, if not I’ll be happy to explain in more detail.
- SSam Choi @Sam_Choi
Thanks Raphael! For someone who uses track presets to do everything, I don't know why I didn't think of that.
In reply toSam_Choi⬆:Chris Shaw @Chris_Shaw2020-10-15 18:35:55.595ZHey Sam,
If you're creating a new Aux track then you don't need thefunction getFirstFreeInsertIndex()at all since a new Aux track won't have any inserts.
Delete that part of the script and just put RX monitor on the first insert like this:sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({ insertOrSend: 'Insert', pluginNumber: 1, pluginPath: ['multichannel plug-in', 'Instrument', 'RX 8 Monitor (stereo)'] });- SSam Choi @Sam_Choi
Hey Chris Thanks for the help! I checked out the code and it works much better now.
Chris Shaw @Chris_Shaw2020-10-15 18:52:40.965Z2020-10-15 18:59:37.207ZThere are other issues I've discovered:
- If you don't have any tracks selected when you run this script, it will create a new track and instead of instantiating the plugin it will change the track height. So you need to invalidate the SF cache after creating the new track.
- If the newly created track is not visible (at the bottom of the session) SF can't click on the first insert so you have to scroll the new track into view
Your code should now look like this:
// Create New Track sf.ui.proTools.menuClick({ menuPath: ["Track", "New..."], }); sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.elementWaitFor(); sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.popupButtons.whoseDescription.is('Track format').first.popupMenuSelect({ menuPath: ["Stereo"], }); sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.popupButtons.whoseDescription.is('Track type').first.popupMenuSelect({ menuPath: ["Aux Input"], }); sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.textFields.whoseTitle.is('Track Name').first.elementSetTextFieldWithAreaValue({ value: "RX Mon", }); sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.buttons.whoseTitle.is('Create').first.elementClick(); sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.elementWaitFor({ waitType: "Disappear", }); // Scroll new track into view sf.ui.proTools.selectedTrack.trackScrollToView(); //Invalidate cache sf.ui.proTools.invalidate(); // Instantiate Insert sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({ insertOrSend: 'Insert', pluginNumber: 1, pluginPath: ['multichannel plug-in', 'Instrument', 'RX 8 Monitor (stereo)'] }); // Solo Isolate track sf.ui.proTools.selectedTrack.buttons.whoseTitle.is('Solo').first.mouseClickElement({ isCommand: true, });
In reply toSam_Choi⬆:Chris Shaw @Chris_Shaw2020-10-15 18:58:23.882ZBTW - this is a handy script. I have a dedicated track in my template with RX monitor already on it but this is a good alternative.👍