Duplicating the playlist of a selected track only works if that track is showing on the screen. If it's scrolled off the top or bottom there is an error. Any thoughts?
sf.ui.proTools.selectedTrack.popupButtons.whoseTitle.is('Playlist selector').first.popupMenuSelect({
menuPath: ["Duplicate..."],
});
- Christian Scheuer @chrscheuer2020-02-15 19:29:06.775Z
Hi Andrew
You can preface your script with this code to make sure the selected track is in view.
sf.ui.proTools.selectedTrack.trackScrollToView();
The reason why it needs to be in view is that the login for opening popup menus requires the popup button to be visible.
Generally speaking SoundFlow first uses UI Automation (which doesn't require elements to be visible), but then in cases where it can't use UI Automation due to limitations in Pro Tools, it falls back to keyboard and mouse simulation techniques (still enhanced by UI Automation though), and in those cases the elements that we simulate mouse clicks on need to be visible on screen.Andrew Scheps @Andrew_Scheps
Thanks Christian, do you ever sleep????? I've made some absolutely gigantic progress in automating all of the boring parts of process today. If we can get Avid to fix the menu issue I'll be all set!
Marco Bernardo @mbernardo2020-02-16 13:35:57.837Z
I think the only way to fix the "Search menu" issue is if we could reset to default with a code, without the need to close Pro Tools and open it again.
- AIn reply toAndrew_Scheps⬆:Andrew Downes @Andrew_Downes
Is there a way to apply this to a selection of tracks? It works perfectly if its just 1 track but if there is more than 1 and the first selected is out of view, it will only select that track.
I should add that I have applied this piece of script to go before a 'select next plugin slot' and a 'select next insert slot'
ThanksChristian Scheuer @chrscheuer2020-02-20 22:47:49.196Z
Try adding a
sf.ui.proTools.selectedTrack.trackScrollToView();
action before calling the above.- AAndrew Downes @Andrew_Downes
This the code I added in the first place. When I enact it it scrolls to the first selected track and then de-selects the the others.
Christian Scheuer @chrscheuer2020-02-23 20:01:19.619Z
Ah yea that makes sense - try this:
function ensureFirstSelectedTrackIsVisible() { var originallySelectedTrackNames = sf.ui.proTools.selectedTrackNames; sf.ui.proTools.selectedTrack.trackScrollToView(); sf.ui.proTools.trackSelectByName({ names: originallySelectedTrackNames, deselectOthers: true }); } ensureFirstSelectedTrackIsVisible(); sf.ui.proTools.selectedTrack.popupButtons.whoseTitle.is('Playlist selector').first.popupMenuSelect({ menuPath: ["Duplicate..."], });
- AAndrew Downes @Andrew_Downes
Hi Christian
Thanks, this works great except if the first track in the session is out of sight, then it deselects all the tracks you wanted and selects the next one. e.g select tracks 1, 2, 3, 4 and 5 with 1 being off the screen ends up with track 6 selected.
Christian Scheuer @chrscheuer2020-02-26 23:08:54.891Z
With this script exactly like I posted it there? That's strange, sounds like a bug in trackSelectByName then.
- In reply tochrscheuer⬆:
Russ Donohue @Russ_Donohue
Hii Christian,
With this script, it works the first time a session is opened, but then I'm getting "No track selected (in Track List View)".
It suggests link track and edit selection, but isn't working either way.
Sorry if I'm missing something obvious!
- DDamon Castillo @Damon_Castillo
I get the same error whether it's New Playlist or Duplicate Playlist. Works the first time but says "Reference Error: Reply is not defined". After that, it doesn't work, saying "No track selected (in Track List View)", although the track is selected and I have Link Timeline and Edit Selection engaged. Would LOVE to get this to work!
- DDamon Castillo @Damon_Castillo
Any fixes yet?
Christian Scheuer @chrscheuer2022-02-09 12:54:16.490Z
Hi Damon,
It might be better to open a new thread for this to get more eyes on it. Threads marked as solved don't get the same attention.
One thing you should consider would be to invalidate SF's track cache, as duplicating tracks might cause issues with it.
Insert this at the top of your script
sf.ui.proTools.mainWindow.invalidate();
Russ Donohue @Russ_Donohue
This seems to have worked!!! Thank you Christian!! This is awesome... Works perfectly
- In reply tochrscheuer⬆:DDamon Castillo @Damon_Castillo
Thank you for the tip on opening new thread!
Yes, this works for me too for both New Playlist and Duplicate Playlist. I still get an error message, but it works!
Thank you Christian!
Damon