No internet connection
  1. Home
  2. Packages
  3. Scheps Session Prep Helpers

Adding Selected tracks to multiple groups

By Ryan DeRemer @Ryan_DeRemer
    2022-04-03 00:30:30.192Z2022-04-03 00:42:58.098Z

    Hey SF Community,

    I noticed while using Scheps "Add To Group" scripts, when I add selected tracks to a group using in the Modify Groups dialog and clicking "Add" next to "Use Tracks Selection from Mix/Edit Window", if I try to use the same method to add those same tracks to a second group, the "Add" button is greyed out, so the command fails, or skips the step and does nothing.

    So it seems the only way to do that is to be able to highlight those tracks from the list of available tracks and use the add button there. Is there any way to use the tracks I have selected in the edit window to highlight the same tracks in the modify groups dialogue?

    This is bumming me out cuz I regularly have tracks assigned to multiple groups at once for different purposes, and this seems to be a detail in Pro Tools for some reason.

    PT 2021.6

    Can anyone confirm if this is different in PT 2021.12?

    Edit: After messing with it a bit, the "Add" button is not greyed out if you are modifying a specific group by right clicking that group and choosing "Modify Group". So if there's a way to do that it would work as well.

    Such a weird thing in PT.

    • 10 replies

    There are 10 replies. Estimated reading time: 14 minutes

    1. Kitch Membery @Kitch2022-04-03 21:31:28.899Z

      Hi @Ryan_DeRemer,

      It looks like this question is about a script in the "Scheps Session Prep Helpers" package. (Please correct me if I'm wrong.)

      I've moved this to the "Scheps Session Prep Helpers" forum. :-)

      For future... The best way to get help with a package created by a SoundFlow user is to ask in the "Packages" section of the SoundFlow User Forum.

      To learn how to do this please watch our video on "How to get help in SoundFlow" specifically the section from 4:18 “Getting Package Help”.

      Rock on!

      1. In reply toRyan_DeRemer:
        Kitch Membery @Kitch2022-04-03 21:31:52.937Z
        1. Ryan DeRemer @Ryan_DeRemer
            2022-04-03 21:46:02.275Z

            Thanks @Kitch !

          • In reply toRyan_DeRemer:
            Andrew Scheps @Andrew_Scheps
              2022-04-04 10:02:15.120Z

              Hi @Ryan_DeRemer ,

              That is a very odd thing! I was just playing with it and I still haven't 100% figured out the logic. I don't have the brain power to figure this out right now, but once Bounce Factory calms down I'll revisit.

              Thanks,
              Andrew

              1. Ryan DeRemer @Ryan_DeRemer
                  2022-04-04 16:47:30.617Z

                  @Andrew_Scheps no worries man. BF is a huge undertaking so I get it. I've gotten around it for now by creating a dummy group, linked to a dummy MIDI track hidden in the session. So instead of using the Modify Groups menu option, I set up a script to right click the dummy group, then navigate to the group I want to add to. Seems this is a feature of the PT Modify Groups dialog, not your script. Food for thought if you're keen to update this script.

                  I'm also going to ask this in the main forum, but I'm curious about your opinion. Is it possible, based on your understanding, to make the Groups List searchable? There's a great script that @chadwahlbrink wrote, which allows you to add and route tracks to an existing routing folder, and you can search for the routing folder track you want to add to. This would be an amazing feature for adding tracks to groups as well, so that one wouldn't need to have a direct preset for each existing group. Your thoughts? Thanks again for everything your doing here.

                  1. Andrew Scheps @Andrew_Scheps
                      2022-04-04 16:54:31.156Z

                      That's exactly the kind of workaround I was thinking. It seems like a piece of the puzzle is if you do Modify Groups from the Group list menu, it defaults to the first group, and if that group has any of the selected tracks already then the buttons are disabled, and stay that way even after switching to another group.

                      I don't want to have to right-click the group that's being modified because that requires it to be visible and would involve scroll the list etc, so instead I'll have to navigate to the proper group, see if the button is active and if not, select the tracks in the track list again. I'm sure it will work but it's not trivial.

                      I think your workaround will work with the existing script if you can get the dummy group first in the list. But of course that list is always in the order the groups were created and isn't sortable in any way.

                      1. Ryan DeRemer @Ryan_DeRemer
                          2022-04-04 17:25:47.158Z2022-04-19 03:32:36.108Z

                          Yes, I had to build the dummy track/group into my template from the jump for it to work. Fine for me, not great as a usable template for others lol. The problem is, it seems like the dummy group MUST either be first in the list, or right clicked for the buttons to be active. The only way it would seem to work (without having the dummy group being the first group in the list) is to create the dummy track, create the dummy group, then right-click the dummy group and go from there. This would solve this hangup in your Add to Group function.

                          However, if I can search the Groups List, then scroll the group into view in the list, I have the command for [right-click > Modify...] already worked out. I would just need to replace the group name/location in my script with a variable for the group being searched and scrolled into view. That way you could add to any group, at any time, regardless of when the group was created or where it is in the list. Also would eliminate the need for the dummy group and track.

                          This is the right-click command as it is with the dummy group first and visible.

                          sf.ui.proTools.appActivate();
                          
                          sf.ui.proTools.trackEnsureTrackListViewIsAccessible({
                              makeVisible: true,
                          });
                          
                          sf.wait({
                              intervalMs: 100,
                          });
                          
                          sf.ui.proTools.mainWindow.groupListView.children.whoseRole.is("AXRow").allItems[1].children.whoseRole.is("AXCell").allItems[1].buttons.whoseTitle.is("a - -groups-").first.mouseClickElement({
                              isRightClick: true,
                              clickType: "Down",
                          });
                          
                          sf.keyboard.press({
                              keys: "m",
                          });
                          
                          sf.keyboard.press({
                              keys: "return",
                          });
                          
                          sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.elementWaitFor();
                          
                          sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.popupButtons.first.popupMenuSelect({
                              menuPath: ["1","c - INST (INST v)"],
                          });
                          
                          sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.buttons.whoseTitle.is("Add").first.elementClick();
                          
                          sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.buttons.whoseTitle.is("OK").first.elementClick();
                          
                          sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.elementWaitFor({
                              waitType: "Disappear",
                          });
                          
                          1. In reply toAndrew_Scheps:
                            Chad Wahlbrink @Chad2022-04-05 01:40:24.784Z2022-04-05 01:57:40.995Z

                            Hey @Andrew_Scheps!

                            I believe I cracked a workaround for the logic on this.

                            The important bit of code is:

                            // Find a group that do not overlap with the selected track
                            let groupRow = sf.ui.proTools.mainWindow.invalidate().groupListView.children.whoseRole.is("AXRow");
                            let groupListLength = groupRow.allItems.length;
                            
                            for (let i = 0; i < groupListLength; i++) {
                                if (groupRow.allItems[i].children.whoseRole.is("AXCell").first.buttons.whoseTitle.is("Track selection contains no member of group").first.exists
                                    || groupRow.allItems[i].children.whoseRole.is("AXCell").first.buttons.whoseTitle.is("Selected. , Track selection contains no member of group").first.exists) {
                                    groupRow.allItems[i].children.whoseRole.is("AXCell").allItems[1].buttons.first.popupMenuSelect({ isRightClick: true, menuPath: ["Modify..."] });
                                    break;
                                }
                            }
                            

                            ↑ This will loop through all of the groups in the group list and try to find one that is not partially or fully a part of any group. That way the "Modify" command works correctly. @Andrew_Scheps, I imagine you could adapt this for your Session Prep Helpers easily!


                            Here's the full script. Also, updated in my store package.

                            //The way all good stories start
                            sf.ui.proTools.appActivateMainWindow();
                            sf.ui.proTools.invalidate();
                            
                            // If Modify Groups Window is open, close it
                            if (sf.ui.proTools.windows.invalidate().whoseTitle.is("Modify Groups").first.exists) {
                                sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.buttons.whoseTitle.is("Cancel").first.elementClick();
                                sf.ui.proTools.windows.whoseTitle.is('Modify Groups').first.elementWaitFor({ waitType: "Disappear" });
                            }
                            
                            // Make sure track list is visible
                            sf.ui.proTools.trackEnsureTrackListViewIsAccessible({
                                makeVisible: true
                            })
                            
                            // Store Selected Track
                            let selectedTracks = sf.ui.proTools.selectedTrackNames;
                            
                            
                            // Find a group that do not overlap with the selected track
                            let groupRow = sf.ui.proTools.mainWindow.invalidate().groupListView.children.whoseRole.is("AXRow");
                            let groupListLength = groupRow.allItems.length;
                            
                            for (let i = 0; i < groupListLength; i++) {
                                if (groupRow.allItems[i].children.whoseRole.is("AXCell").first.buttons.whoseTitle.is("Track selection contains no member of group").first.exists
                                    || groupRow.allItems[i].children.whoseRole.is("AXCell").first.buttons.whoseTitle.is("Selected. , Track selection contains no member of group").first.exists) {
                                    groupRow.allItems[i].children.whoseRole.is("AXCell").allItems[1].buttons.first.popupMenuSelect({ isRightClick: true, menuPath: ["Modify..."] });
                                    break;
                                }
                            }
                            
                            // wait for Modify Groups Window
                            sf.ui.proTools.windows.whoseTitle.is('Modify Groups').first.elementWaitFor({ waitType: "Appear" });
                            
                            // declare Group Selector Button
                            let groupSelectorBtn = sf.ui.proTools.windows.whoseTitle.is('Modify Groups').first.popupButtons.whoseTitle.is('GroupIDView').first;
                            
                            // Fetch all current groups
                            let items = groupSelectorBtn.popupMenuFetchAllItems({
                                isRightClick: true,
                            }).menuItems.map(function (item) {
                                return {
                                    name: item.names.join(' > '),
                                    path: item.names
                                };
                            });
                            
                            // Filter Results
                            let chosenPathFiltered = items.filter(function (str) {
                                if (str.name.length > 5) {
                                    return str.name;
                                }
                            });
                            
                            // Search for an existing Group
                            let chosenPath = sf.interaction.popupSearch({
                                items: chosenPathFiltered,
                                title: 'Add to Group'
                            }).item.path;
                            
                            // Select the Group
                            groupSelectorBtn.popupMenuSelect({
                                menuPath: chosenPath
                            });
                            
                            // Add to the Group
                            sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.buttons.whoseTitle.is("Add").first.elementClick();
                            sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.buttons.whoseTitle.is("OK").first.elementClick();
                            
                            // Wait for this to Disappear
                            sf.ui.proTools.windows.whoseTitle.is('Modify Groups').first.elementWaitFor({ waitType: "Disappear" });
                            
                            // Restore Selection
                            sf.ui.proTools.trackDeselectAll();
                            
                            sf.ui.proTools.trackSelectByName({
                                names: selectedTracks,
                                deselectOthers: true,
                            });
                            
                            
                            1. DDaniel Holsinger @Daniel_Holsinger
                                2023-05-08 15:02:08.898Z

                                Hey Chad, This code is amazing!!!
                                How would I change it to only send to only one group that I have already predecided on, without searching like it does now?
                                So every time it would send to my "all music" group.

                                Thanks in advance.

                                1. David Stagl @David_Stagl
                                    2023-11-22 22:12:13.794Z

                                    Any idea on this @Chad? I'm looking to do the same thing.