By Jack Green @Jack_Green
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.411Z
This should do it:
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 firstTrack = sf.ui.proTools.visibleTrackNames[0]; // Define first track solo button const firstSoloButton = sf.ui.proTools.trackGetByName({ name: firstTrack }).track.buttons.whoseTitle.is("Solo").first; // Get tracks that are currently selected const origSelectedTracks = sf.ui.proTools.selectedTrackNames 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(); };
- Progress