Hello,
I want to show/hide a track and select it.
I have this script that works but it still gives me a error log :
SCRIPT :
const trackMatch = sf.ui.proTools.trackNames.filter(x => x.match('MUZIEK galm'))
globalState.showtoggle = !globalState.showtoggle
if (globalState.showtoggle) {
// Hide Tracks
sf.ui.proTools.trackSelectByName({ names: trackMatch })
sf.ui.proTools.trackVisibilityHideSelected()
} else {
// Show Tracks
sf.ui.proTools.trackShowByName({ names: trackMatch })
}
sf.ui.proTools.trackGetByName({ name: "MUZIEK galm" }).track.trackSelect();
ERROR in LINE 21 :
Cannot read property 'track select' of null
(MUZIEK galm line 18)
The problem is when track is selected and want to HIDE it again it give me the error
Greetings, David
samuel henriques @samuel_henriquesHello David,
If you are trying to show/hide one track named "MUZIEK galm"
this should work:const trackName = "MUZIEK galm" let visibleTracks = sf.ui.proTools.visibleTrackNames // If track is visible if (visibleTracks.indexOf(trackName) >= 0) { // Select Track sf.ui.proTools.trackGetByName({ name: trackName }).track.trackSelect() // Hide Selected sf.ui.proTools.trackVisibilityHideSelected({}) } else { // If the track to show is selected, the command wont work so we need to deselect all tracks, just as safety sf.ui.proTools.trackDeselectAll() sf.ui.proTools.trackGetByName({ name: trackName, makeVisible: true }).track.trackSelect() }Let me know if instead you want to show/hide several tracks containing "MUZIEK galm" on the name.
- DDavid Heylen @David_Heylen5
Hello Samuel,
Thanks for the help but still have a error :
Could not evoke 'Hide Selected tracks' (MUZIEK galm copy line 12)
Could not open track list popup menu
popup menu was not foundGreetings,
David
samuel henriques @samuel_henriquesCould you double check if the track list is open?
- DDavid Heylen @David_Heylen5
I always keep it closed when mixing and want it that way.
I have a workaround with a extra "hide selected track" macro for now but it would be great if those two buttons go into a toggle.
samuel henriques @samuel_henriquesok, cool, but would you mind if the track list opens and closes to show/hide the track, or you would prefer if you never see it at all?
But you can confirm the script works if the clip list is open?
- DDavid Heylen @David_Heylen5
It can open/close when showing.
I did the test when the track list (and clip list) is open but same error.
PS how do I copy the error log file into this forum?
samuel henriques @samuel_henriquestry this one, it won't open track list,
sf.ui.proTools.appActivateMainWindow() const trackName = "MUZIEK galm" let visibleTracks = sf.ui.proTools.visibleTrackNames // If track is visible if (visibleTracks.indexOf(trackName) >= 0) { // Select Track sf.ui.proTools.trackGetByName({ name: trackName }).track.trackScrollToView() // Hide Selected sf.ui.proTools.selectedTrack.popupButtons.first.popupMenuSelect({isRightClick:true, menuPath:["Hide"]}) } else { // If the track to show is selected, the command wont work so we need to deselect all tracks, just as safety sf.ui.proTools.trackDeselectAll() sf.ui.proTools.trackGetByName({ name: trackName, makeVisible: true }).track.trackSelect() }
samuel henriques @samuel_henriquesto copy the log info
click log file and look for the error message, at the end, don't post the complete log, it might have loads of information not related
- In reply tosamuel_henriques⬆:DDavid Heylen @David_Heylen5
Thank you Samuel it works.
Going to test some more so it opens the first plug in too.
But thank you very much
David
samuel henriques @samuel_henriquesCool.
just noticed a mistake on the comment
// If track is not visibleshould be// If track is visible
- In reply toDavid_Heylen5⬆:
samuel henriques @samuel_henriquessame error is this ?
Could not evoke 'Hide Selected tracks' (MUZIEK galm copy line 12)
Could not open track list popup menu
popup menu was not found
samuel henriques @samuel_henriquesIf the track list is open but the popup is covered, it won't work either.
