Hi,
Very new and I know nothing about scripting...
Basically looking to Select the first track in my session (This is always the Reference mix supplied by my client) Unmute it and solo it, Then on the next press Mute and Unsolo it. It always the first track of the session but i dont normally bother naming it anything special.
Ive seen some posts on solo and muting, And some on selecting the last track of a session. But I dont know how to adapt the code to make it the first track.
Thanks in advance
Jack
Chris Shaw @Chris_Shaw2022-04-20 20:36:48.411Z2025-06-12 15:45:53.283ZThis should do it:
const desiredTrack = "first" // or "last" sf.ui.proTools.mainWindow.invalidate(); function getSoloState(trackName) { const track = sf.ui.proTools.trackGetByName({ name: trackName }).track; const trackHasSoloBtn = !track.title.invalidate().value.endsWith(" - Master Track "); return trackHasSoloBtn ? track.isSoloed : false; }; // Get first visible track in session const visibleTrackNames = sf.ui.proTools.visibleTrackNames const firstTrack = visibleTrackNames[0]; const lastTrack = visibleTrackNames[visibleTrackNames.length - 1]; const targetTrack = desiredTrack == "first" ? firstTrack : lastTrack // Define first track solo button const firstSoloButton = sf.ui.proTools.trackGetByName({ name: targetTrack }).track.buttons.whoseTitle.is("Solo").first; if (getSoloState(firstTrack) == false) { // If track isn't solo-ed unmute track and click solo button sf.ui.proTools.trackSetMuteByName({ name: firstTrack, targetValue: 'Disable' }); firstSoloButton.elementClick(); } else { // If track is solo-ed mute track and click solo button sf.ui.proTools.trackSetMuteByName({ name: firstTrack, targetValue: 'Enable' }); firstSoloButton.elementClick(); };- AArtem Shcherbakov @Artem_Shcherbakov
Hey Chris!
Any chance you could do a version for the latest track as well? I just can’t seem to crack it 🥲
Chris Shaw @Chris_Shaw2025-06-12 15:47:30.780ZHey @Artem_Shcherbakov,
I edited the code above to do either.
Just changedesiredTrackat the top of the script to either"first"or"last"to do what you want.- AArtem Shcherbakov @Artem_Shcherbakov
Thanks for the help, Chris! 🙏
The updated script didn’t fully work for me just by changing "first" or "last" at the top — a few other lines still referenced the first track directly.
Here’s the version I put together — not sure if it’s the most proper way to do it, but it works as expected for me :)const desiredTrack = "last" sf.ui.proTools.mainWindow.invalidate(); function getSoloState(trackName) { const track = sf.ui.proTools.trackGetByName({ name: trackName }).track; const trackHasSoloBtn = !track.title.invalidate().value.endsWith(" - Master Track "); return trackHasSoloBtn ? track.isSoloed : false; }; // Get first visible track in session const visibleTrackNames = sf.ui.proTools.visibleTrackNames const firstTrack = visibleTrackNames[0]; const lastTrack = visibleTrackNames[visibleTrackNames.length - 1]; const targetTrack = lastTrack // Define first track solo button const firstSoloButton = sf.ui.proTools.trackGetByName({ name: targetTrack }).track.buttons.whoseTitle.is("Solo").first; if (getSoloState(lastTrack) == false) { // If track isn't solo-ed unmute track and click solo button sf.ui.proTools.trackSetMuteByName({ name: lastTrack, targetValue: 'Disable' }); firstSoloButton.elementClick(); } else { // If track is solo-ed mute track and click solo button sf.ui.proTools.trackSetMuteByName({ name: lastTrack, targetValue: 'Enable' }); firstSoloButton.elementClick(); };
- In reply toChris_Shaw⬆:NNoah Dunbar @Noah_Dunbar
Hey Chris - I hate to revive an old thread, but is there a quick and easy way to modify this script to simply mute / unmute the first track in the session without any solo-ing? I just need a button mute/unmute my turnover folder without negating any solo's in the session, but I haven't learned much scripting yet....
Thanks,
Noah- OOwen Granich-Young @Owen_Granich_Young
This package allows you to make 'snapshots' on buttons of any given states of tracks to 'toggle' or 'Store'.
Create settings like this on a preset :
And then while you have the track (or tracks you want Toggle state set on) Hold CMD while pressing the button to store the target track. Then every time you press the button it will toggle the state of MUTE on that track. If you're doing it with keyboard shortcuts instead of a stream deck make sure to make it two keyboard shortcuts both the CMD+KeyboardButton and the KeyboarButton alone or it won't know how to store.
Bests,
Owen
- Progress

