No internet connection
  1. Home
  2. How to

Change track display to Send Automation with partial name.

By Mitch Willard @Mitch_Willard_the2nd
    2022-07-21 04:45:24.844Z

    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

    Solved in post #2, click to view
    • 5 replies
    1. 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],
      });
      
      Reply1 LikeSolution
      1. Mitch Willard @Mitch_Willard_the2nd
          2022-07-21 22:49:15.434Z

          Works like a charm! You're the best @raphaelsepulveda, now I know also how to apply it in future.

        • O

          Also check this one that @Chris_Shaw built out - not 100% if this is the same functionality you're looking for?

          1. The Final Script Chris wrote (realized there's a few iterations in there)

            1. Mitch Willard @Mitch_Willard_the2nd
                2022-07-21 22:50:21.405Z

                These are great @Owen_Granich_Young, I really appreciated it.