Hello,
I'm using this script to keep the track output window open and changing to the last selected track, and works fine.
Could anyone help me change it so it would;
1.work only if the Output window is open; at this time if the window is closed it opens it;
2: only on any track that start with these words; a loose thing, I guess
" _MUSICA" and " _FX".
Thank you so much
var lastFocusedTrackName;
function main() {
try {
var newName = sf.ui.proTools.selectedTrackNames[0];
if (newName === lastFocusedTrackName || newName === undefined) return;
lastFocusedTrackName = newName;
sf.ui.proTools.selectedTrack.trackOutputToggleShow();
} catch (err) {
}
}
function runForever(name, action, interval, timeout) {
var now = (new Date).valueOf();
if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
globalState[name] = now;
sf.engine.runInBackground(function () {
try {
while (true) {
sf.engine.checkForCancellation();
globalState[name] = (new Date).valueOf();
action();
sf.wait({ intervalMs: interval, executionMode: 'Background' });
}
} finally {
globalState[name] = null;
}
});
}
runForever("isScrollToFocusedTrackRunning", main, 500, 5000);
- Christian Scheuer @chrscheuer2020-09-09 15:57:25.255Z
Just clarifying..
So what should happen if the track output window is open and you're on a "_FX.." track but you move to a track that's not a "_FX" track. Should it then close the output window? Or just not change the output window and leave it open?samuel henriques @samuel_henriques
Hey Christian,
Forgot that one.
I would like it to stay open.
for example, I can select an _FX and if I click a dialog the _FX 's output window will still be there.
Thank you, that was fastChristian Scheuer @chrscheuer2020-09-09 17:02:10.438Z
Ok, so to be sure, you just want the script changed so that it doesn't open the track output window?
Christian Scheuer @chrscheuer2020-09-09 17:05:05.002Z
You should be able to change this:
sf.ui.proTools.selectedTrack.trackOutputToggleShow();
To this:
if (sf.ui.proTools.mainTrackOutputWindow.invalidate().exists && sf.ui.proTools.selectedTrack.outputWindowButton.value.invalidate().value !== 'open') sf.ui.proTools.selectedTrack.trackOutputToggleShow();
samuel henriques @samuel_henriques
Perfect that's one of the things.
Now, when its open, only follow the track selection of tracks whose name start with " _MUSICA" and " _FX".thank you
Christian Scheuer @chrscheuer2020-09-09 17:31:42.329Z
Then, change it to:
if (sf.ui.proTools.mainTrackOutputWindow.invalidate().exists && sf.ui.proTools.selectedTrack.outputWindowButton.value.invalidate().value !== 'open' && (newName.indexOf(' _MUSICA') == 0 || newName.indexOf(' _FX') == 0)) sf.ui.proTools.selectedTrack.trackOutputToggleShow();
samuel henriques @samuel_henriques
Sorry, It's not following any now.
thank you for your patience
Christian Scheuer @chrscheuer2020-09-09 17:49:45.817Z
It's likely you need to adjust the names as quoted in the script. You put them as a space followed by an underscore and then the letters. If you didn't mean to put in a space, remove it in the script.
samuel henriques @samuel_henriques
Awesome !!!!
Thank you so much
- In reply tochrscheuer⬆:NN Leyers @NickLeyers_old_acc
I like the idea of this script. I use the main script as well, but have extra macro's to bypass the script. A little bulcky compared to this: open or close the output window.
But if I add this line to my script, I'm getting this error: Could not get UIElement for AxPtMainTrackOutputWindow: Could not find floating window for track outputI don't know why it does that, but I think it has got something to do with focussing on my edit screen. Is it possible that stream decks take of focus of the edit screen when I assign them to change on window triggers? Or is it something else?
- NN Leyers @NickLeyers_old_acc
Found it. My track view window at the left was hidden. For another reason I have to figure out, it keeps hiding itself randomly :-)
- In reply tosamuel_henriques⬆:Erik Griekspoor @Erik_Griekspoor
This is a great script! Is there a way to cancel just this script when its running?
Christian Scheuer @chrscheuer2021-12-29 17:44:17.429Z
I seem to remember there's another thread somewhere that has a companion script to go with it where you can toggle the behavior on/off.
Erik Griekspoor @Erik_Griekspoor
Ok thanks, I can't find it though, can you?
Christian Scheuer @chrscheuer2021-12-30 13:39:47.251Z
Change the
main
function to:function main() { try { if (globalState.isFollowTrackOutputBypassed) return; var newName = sf.ui.proTools.selectedTrackNames[0]; if (newName === lastFocusedTrackName || newName === undefined) return; lastFocusedTrackName = newName; sf.ui.proTools.selectedTrack.trackOutputToggleShow(); } catch (err) { } }
And then for the bypass toggling script:
globalState.isFollowTrackOutputBypassed = !globalState.isFollowTrackOutputBypassed;