Hi all,
I have this script where I can change the track display to the send "Level" automation line by searching all available send on the selected track.
The part I'm getting stuck on is after selecting a send from the pop up menu, I'm struggling to make the code only see part of the name,
for example
If the send selected is "Verb" when using menuSelector
it needs and additional " (snd a)"
in front in able to select it properly, with does not appear in the sf.interaction.popupSearch
. I'm using viewType
to help the menuSelector
point to the desired selection.
so when "Verb"
is selected, it select " (snd a) Verb"
in the menu, but if I choose a different send, it will select the right path.
How can I make it select the send automaton display using the info returned by the popup menu while ignore the " (send a)"
part of the code?
I tried "${viewType}
but I'm clearly getting it wrong.
sf.ui.proTools.appActivateMainWindow();
sf.ui.proTools.mainWindow.invalidate();
const selectedTrackSendAssignments = sf.ui.proTools.selectedTrack.sendButtons.map(sendBtn => sendBtn.value.value);
var sendsView = selectedTrackSendAssignments;
var viewSelect = sf.interaction.popupSearch({
title: "Select Send",
items: sendsView.map(p => ({
// @ts-ignore
name: p.replace(viewSelect, '').substring(0),
path: p,
})),
}).item.name;
sf.ui.proTools.appActivateMainWindow;
let viewType = viewSelect
sf.ui.proTools.selectedTrack.displaySelectorButton.popupMenuSelect({
menuSelector: items => items.filter(i => i.path[0] === viewType && i.path[1] === "level")[0],
});
I feel like I'm waffling, hope that makes sense.
thanks
Mitch
- Raphael Sepulveda @raphaelsepulveda2022-07-21 15:48:04.024Z
Hey @Mitch_Willard,
This should help:
sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); const selectedTrackSendAssignments = sf.ui.proTools.selectedTrack.sendButtons.map(sendBtn => sendBtn.value.value); const sendAssignment = sf.interaction.popupSearch({ title: "Select Send", items: selectedTrackSendAssignments.map(p => ({ name: p })), }).item.name; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.selectedTrack.displaySelectorButton.popupMenuSelect({ menuSelector: items => items.filter(i => i.path[0].endsWith(sendAssignment) && i.path[1] === "level")[0], });
Mitch Willard @Mitch_Willard_the2nd
Works like a charm! You're the best @raphaelsepulveda, now I know also how to apply it in future.
- OIn reply toMitch_Willard_the2nd⬆:Owen Granich-Young @Owen_Granich_Young
Also check this one that @Chris_Shaw built out - not 100% if this is the same functionality you're looking for?
- OOwen Granich-Young @Owen_Granich_Young
The Final Script Chris wrote (realized there's a few iterations in there)
Mitch Willard @Mitch_Willard_the2nd
These are great @Owen_Granich_Young, I really appreciated it.