Search Groups List
Hey all,
Anyone have an idea how I might make the Groups List searchable (a la @chadwahlbrink 's "Move and Route Tracks to Existing Folder (searchable)")? I'm working on a script that would add tracks to a group dynamically, based on searching the groups list and modifying the group directly.
Ideas about scrolling the Groups List to make the desired group visible is also appreciated.
Thanks! This community is awesome!
Linked from:
- Chad Wahlbrink @Chad2022-04-04 18:33:58.465Z
Hey @Ryan_DeRemer!
Is the goal to:
- select some tracks in Pro Tools
- fire off the script
- Search the available groups
- modify the selected group to add tracks to that group
I haven't messed with the group list much, but I want to understand your desired result more before I poke around (as I have time).
Ryan DeRemer @Ryan_DeRemer
@chadwahlbrink Yessir! That's exactly it. I tagged you in a convo with Andrew Scheps about this as well, detailing some of the road blocks we've been having with these "Add to Group" scripts. It may be a factor if you're messing around with it. Check that convo out here:
I'm working on a mix today so I'm just popping in and out until later tonight.
- In reply toRyan_DeRemer⬆:
Chad Wahlbrink @Chad2022-04-04 21:33:02.144Z2022-04-05 01:41:53.745Z
Yo, @Ryan_DeRemer,
Curiosity got the best of me.
Try this script out (it's also now in my CW Pro Tools Utilities package if you update):
see the modified script below
Ryan DeRemer @Ryan_DeRemer
@chadwahlbrink This is killer! Working here as well.
The only gripe is the same as Andrew and I were discussing before, about the add button being inactive using "Modify Groups" from the Groups List menu. See that post for details.
I appreciate you sharing the code tho, I'm going to work on it tonight and see if I can get around it some way. I'll share it here if I can figure it out.
Chad Wahlbrink @Chad2022-04-04 23:46:30.629Z
Can you explain this a bit more? @Ryan_DeRemer
click to show
- In reply toRyan_DeRemer⬆:Chris Shaw @Chris_Shaw2022-04-28 17:59:43.230Z2022-04-28 18:08:44.565Z
Chad,
This is a great script.
I think I have a challenge for you:
Can you build a script that removes a selected track from any/all groups that it may be a part of?
You seem to have most of the code needed to do it.
@Thomas_Gloor would be particularly interested :)- TThomas Gloor @Thomas_Gloor
@chadwahlbrink thanks for that script it's great!
@Chris_Shaw has a point, I would be SUPER interested as I'm struggling with this issue for a while now! Would be amazing if you had an idea :)
- In reply toChris_Shaw⬆:
Ryan DeRemer @Ryan_DeRemer
+1 on this. It's been on my list but I may not get to it for a while.
- In reply toChris_Shaw⬆:
Chad Wahlbrink @Chad2022-04-28 23:43:23.876Z
Ooo. I accept your challenge. I will look into it.
- In reply toChris_Shaw⬆:
Ryan DeRemer @Ryan_DeRemer
@Chris_Shaw @Thomas_Gloor Here's a pretty straightforward way to remove ALL groups on selected tracks. Also skips empty tracks. I'm working on an undoable version using Track Presets, but the groups are stubborn. Can't seem to get the recalled preset to overwrite the group data.
The real challenge (and my challenge to @chadwahlbrink ) is building a script that removes a SELECTED (searchable) group from selected tracks. I've got it started, but the tricky part is selecting the tracks in the "Currently in Group" table in the "Modify Group" dialog. Haven't figured that part out yet. @raphaelsepulveda helped me out on manipulating the templates table in the Dashboard so maybe he has some insight?
Anyway, here's Wonderwall:
const origTracks = sf.ui.proTools.selectedTracks.names; function renameTrack(track, dupTrack) { sf.ui.proTools.invalidate(); sf.ui.proTools.trackSelectByName({ deselectOthers: true, names: dupTrack }); sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({ isRightClick: true, menuPath: ['Rename...'] }); let renameDlg = sf.ui.proTools.windows.first; renameDlg.elementWaitFor({ waitType: 'Appear' }); renameDlg.textFields.first.elementSetTextFieldWithAreaValue({ value: track }); renameDlg.buttons.whoseTitle.is('OK').first.elementClick(); let newTrack = sf.ui.proTools.selectedTracks.names; let newTrackName = newTrack.join(); sf.ui.proTools.invalidate(); sf.ui.proTools.trackSelectByName({ deselectOthers: true, names: newTrack }); let playlistSelector = sf.ui.proTools.selectedTrack.popupButtons.allItems[1]; let playlistSelectorMenuItems = playlistSelector.popupMenuFetchAllItems({ dismissMenu: true }).menuItems; let playlistNames = playlistSelectorMenuItems.map(menuItem => { if (/ \(\d+\)$/.test(menuItem.path[0])) return menuItem.path[0]; }).filter(Boolean); if (playlistNames.length > 1) { for (let i = 0; i < playlistNames.length; i++) { let playlistTitle = playlistNames[i]; let playlistTitleStr = playlistTitle.split(' ').slice(0, -1).join(' '); let playlistName = playlistTitle.split('.dup').slice(0, 1).join(); if (playlistTitleStr !== newTrackName) { playlistSelector.popupMenuSelect({ menuPath: [playlistTitle] }); sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({ isRightClick: true, menuPath: ['Rename...'] }); let renameDlg = sf.ui.proTools.windows.first; renameDlg.elementWaitFor({ waitType: 'Appear' }); renameDlg.textFields.first.elementSetTextFieldWithAreaValue({ value: playlistName }); renameDlg.buttons.whoseTitle.is('OK').first.elementClick(); } } playlistSelector.popupMenuSelect({ menuPath: ['*' + newTrackName + ' (*)'], useWildcards: true }); } } function removeGroups() { sf.ui.proTools.trackSelectByName({ deselectOthers: true, names: [origTracks[0]] }); sf.ui.proTools.selectedTrack.trackScrollToView(); sf.ui.proTools.mainWindow.invalidate(); sf.ui.proTools.trackSelectByName({ deselectOthers: true, names: origTracks }); origTracks.forEach(track => { sf.ui.proTools.trackSelectByName({ deselectOthers: true, names: [track] }); sf.ui.proTools.selectedTrack.trackScrollToView(); sf.ui.proTools.invalidate(); sf.ui.proTools.selectedTrack.titleButton.mouseClickElement(); let trackDelete = sf.ui.proTools.getMenuItem('Track', 'Delete').exists; if (!trackDelete) { sf.ui.proTools.menuClick({ menuPath: ['Track', 'Duplicate...'] }); let dupWin = sf.ui.proTools.duplicateTracksDialog; let checkBoxes = dupWin.checkBoxes.allItems; dupWin.elementWaitFor({ waitType: 'Appear' }); checkBoxes.forEach(box => box.checkboxSet({ targetValue: 'Enable' })); checkBoxes[5].checkboxSet({ targetValue: 'Disable' }); dupWin.buttons.whoseTitle.is('OK').first.elementClick(); dupWin.elementWaitFor({ waitType: 'Disappear' }); let dupTrack = sf.ui.proTools.selectedTracks.names; sf.ui.proTools.invalidate(); sf.ui.proTools.trackSelectByName({ deselectOthers: true, names: [track] }); sf.keyboard.press({ keys: "left" }); if (sf.ui.proTools.getMenuItem('Track', 'Delete...').exists) { sf.ui.proTools.trackDelete(); sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Appear' }); sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is('Delete').first.elementClick(); sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Disappear' }); } else { sf.ui.proTools.trackDelete(); } let confirmDeletePlaylist = sf.ui.proTools.confirmationDialog; let deleteBtn = confirmDeletePlaylist.invalidate().buttons.whoseTitle.is('Delete').first; if (confirmDeletePlaylist.exists) deleteBtn.elementClick(); renameTrack(track, dupTrack); } }); sf.ui.proTools.mainWindow.invalidate(); sf.ui.proTools.trackSelectByName({ deselectOthers: true, names: origTracks }); sf.ui.proTools.invalidate(); } removeGroups();
- TThomas Gloor @Thomas_Gloor
hey @Ryan_DeRemer. Thank you so much for this! It will be super helpful, but something doesn't seem to work on my rig.
I tried it, but it only fiddles with the tracks (select/deselect) but nothing else happens. Any idea?
Ryan DeRemer @Ryan_DeRemer
Hey @Thomas_Gloor !
Can you post a screen record of the script running? I'd like to see what is happening. Does the script fail? Or does it run just without doing anything? Also what version of PT/macOS are you running?
Ryan DeRemer @Ryan_DeRemer
Keep in mind the script only runs on tracks with clips. It skips any and all empty tracks.
- TThomas Gloor @Thomas_Gloor
MY BAD! The track was empty! It's awsome. I basically did the same thing in a very less elegant way. This is of great healp! Script works pe
click to show
- In reply toRyan_DeRemer⬆:
Ryan DeRemer @Ryan_DeRemer
Hadn't thought of that! that's a great idea. I'll look into it. Would be SO MUCH EASIER (and undoable) if recalling the track preset overwrote the groups. I tried so many different ways, but it seems like it only adds groups none-destructively. :( I'm stubborn and still trying to find a way around it.
The script should already confirm deleting the tracks. What are you running into there? I'll try to address it.
I'll look any better ways to do this. This was a pretty thrown-together first crack at it lol. I'm also looking into getting it to skip tracks that have no groups assigned.
- TThomas Gloor @Thomas_Gloor
Thank you so much Ryan. This script would be a real life safer, as I often deal with pretty complex group architecture (mostly because I'm printing a lot of FX etc...).
I'm fairly new to this, but I assume it would involve listing all the playlists or a selected track (if even possible) and removing the suffix. Or listing the playlists of the original track, storing them and applying them to the duplicate after erasing the original? Problem is I have no clue how to do it :(Yes it dismisses the DELETE TRACK, but I tried it with a track that has alternate playlists containing audio, and it doesn't dismiss the "the track you are about to erase contains alternate playlists. Delete or keep"?
- In reply toRyan_DeRemer⬆:TThomas Gloor @Thomas_Gloor
I have that little piece of script to dismiss dialogs
function dismissConfirmationDialog(btn) { if (sf.ui.proTools.confirmationDialog.invalidate().buttons.whoseTitle.is(btn).first.exists) { sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is(btn).first.elementClick(); } }; dismissConfirmationDialog("Delete"); ``` could you tell me where to place the command in your script so it makes sense with the playlists? I'm having trouble finding the right place
Ryan DeRemer @Ryan_DeRemer
Ah for sure. Got me thinking I'm gonna go back through my scripts to test for playlists. I know what I'm doing this weekend lol!
click to show
- FIn reply toRyan_DeRemer⬆:Forrester Savell @Forrester_Savell
@Ryan_DeRemer @Chad was there a solution for scrolling/resizing the Group List to make off-screen groups visible?
I've a script that goes through and removes any group with one member. Works great, except it breaks when reactivating the previously active groups (minus the deleted ones) if any of them are below the visible groups in the Group List.