"Output window Follows selection(Toggle)" command stopped working after 4.1.1
You helped me with a script a while back. Has worked great up until 4.1.1.
It throws the error;
Error: Object reference is not set to an instance of an object.
(Output Window Follows Selection (toggle) line 25.)
I'm not skilled enough in javascript to sort this out.
var lastFocusedTrackName;
function main() {
try {
var newName = sf.ui.proTools.selectedTrackNames[0];
if (newName === lastFocusedTrackName || newName === undefined) return;
lastFocusedTrackName = newName;
if (!globalState.isFollowFocusedTrackActive) return;
if (sf.ui.proTools.selectedTrack.outputWindowButton.value.invalidate().value !== 'open')
sf.ui.proTools.selectedTrack.trackOutputToggleShow({ onError: 'Continue' });
} 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("isFollowFocusedTrackRunning", main, 500, 5000);
- SEmil Isaksson @studiomollan
Found the initial thread here:
https://forum.soundflow.org/-1597/application-trigger-toggle-on-off#post-13Christian Scheuer @chrscheuer2020-09-17 14:49:19.510Z
Thanks for reporting, Emil.
Can I get you to log an additional report through this? Then I'll get your log files which hopefully will reveal some more info.
Please click here to send us the information we need- SEmil Isaksson @studiomollan
Done
Christian Scheuer @chrscheuer2020-09-18 09:15:09.443Z
Ah, my bad. Thanks for the report.
Christian Scheuer @chrscheuer2020-09-22 13:14:25.514Z
Hi Emil,
I'm having trouble reproducing this here.
Can you share the exact code you have in the script "Output Window Follows Selection (toggle)"?- SEmil Isaksson @studiomollan
sure;
’’’
globalState.isFollowFocusedTrackActive = !globalState.isFollowFocusedTrackActive;log(
Follow Focused Track is now: ${globalState.isFollowFocusedTrackActive ? 'ON' : 'OFF'}
);
’’’- SEmil Isaksson @studiomollan
This is what i get when i turn it on.
- SEmil Isaksson @studiomollan
Should i maybe just reinstall SoundFlow?
Christian Scheuer @chrscheuer2020-09-22 14:30:55.816Z
Hi Emil.
Thank you for this. What confused me is that the line in the error message says line 25 but there are only a few lines in your script.
Your feedback gave me an idea though as to what may be going on. I'll try to go down that road to see if I'm right and get back to you.Christian Scheuer @chrscheuer2020-09-22 14:31:53.957Z
And FWIW I don't think the error is on your end. I think it's a bug. Just trying to figure out where it comes from.
- SEmil Isaksson @studiomollan
Ok cool.Thanks!
- In reply tochrscheuer⬆:
samuel henriques @samuel_henriques
Hey Christian,
I'm using a version of the same code and am getting an error as well.Error: Object reference not set to an instance of an object.
(Track Output Folow track selection line 27)I'm stoping all soundflow commands and restarting the script and woks again for a wile.
I'll put this on a Help/Issue if you prefer
Thank you
var lastFocusedTrackName; function main() { try { var newName = sf.ui.proTools.selectedTrackNames[0]; if (newName === lastFocusedTrackName || newName === undefined) return; lastFocusedTrackName = newName; 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(); //sf.ui.proTools.selectedTrack.trackInsertToggleShow({ //}); } 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-25 20:01:31.426Z
Hi Samuel.
Thanks! I'm pretty sure I have an idea of what causes this, but thanks for offering a Help/Issue report. I'll ask for it if we need more help but for now we're all set :)
- SIn reply tostudiomollan⬆:Emil Isaksson @studiomollan
and one more thing.
I tried asking for help in the SF app but it gave me Error no window reference, or something similar. - SIn reply tostudiomollan⬆:Emil Isaksson @studiomollan
Still the same for me. FYI. It generally works but i get "Error: Object reference is not set to an instance of an object." whenver im in finder and go back to pro tools. And sometimes within pro tools as well i think.
Christian Scheuer @chrscheuer2020-11-08 12:29:07.845Z
Hi Emil,
What's your SF version?
- SEmil Isaksson @studiomollan
4,1,4
Christian Scheuer @chrscheuer2020-11-08 12:36:53.838Z
Thanks - please check if a manual upgrade to 4.1.6 helps (it should):
https://soundflow.org/cp/install- SEmil Isaksson @studiomollan
cool . will do and report back.
- In reply tostudiomollan⬆:SEmil Isaksson @studiomollan
Restart SF and it works for a while. Can't say what's the trigger for the error message. It feels random.