This script shows how to programmatically set the pan for a stereo track -> stereo output.
- Christian Scheuer @chrscheuer2018-06-29 21:09:05.247Z
//Config var howWide = 45; //Reset pan first sf.ui.proTools.trackOutputWindowResetPan(); var win = sf.ui.proTools.mainTrackOutputWindow; //Get the two front pan knobs var pans = win.getElements('AXChildren').filter(function(e){ return e.title.value === "Front Pan Knob" }); //Step through decrementing (turning left) Front Left pan, and incrementing (turning right) Front Right pan //thus widening the pan (because we start at center) var steps = Math.floor(howWide/5); for(var i=0; i<steps; i++) { pans[0].elementClick({actionName: 'AXDecrement'}); pans[1].elementClick({actionName: 'AXIncrement'}); }
- In reply tochrscheuer⬆:Christian Scheuer @chrscheuer2018-06-29 21:22:00.814Z
Here's a version that sets the pan and writes it to the selected clip:
//Config var howWide = 60; //Enable preview sf.ui.proTools.automationPreview({ targetValue: 'Enable' }); //Reset pan first sf.ui.proTools.selectedTrack.trackOutputToggleShow(); sf.ui.proTools.trackOutputWindowResetPan(); var win = sf.ui.proTools.mainTrackOutputWindow; //Get the two front pan knobs var pans = win.getElements('AXChildren').filter(function(e){ return e.title.value === "Front Pan Knob" }); //Step through decrementing (turning left) Front Left pan, and incrementing (turning right) Front Right pan //thus widening the pan (because we start at center) var steps = Math.floor(howWide/5); for(var i=0; i<steps; i++) { pans[0].elementClick({actionName: 'AXDecrement'}); pans[1].elementClick({actionName: 'AXIncrement'}); } sf.ui.proTools.automationWriteAutoToSelectionAndCloseWindows();
Fokke van Saane @Fokke
after the action protools prompts me : No Automation was written
Christian Scheuer @chrscheuer2018-07-21 11:47:16.475Z
@Fokke I think I forgot to mention this action requires that you have 'Pan' enabled in the automation window.
We could add that to the script if that's not something you are usually using.Fokke van Saane @Fokke
it is enabled and still does it
Fokke van Saane @Fokke
Sorry, for some reason it works now.
But it does leave PREVIEW on in the Automation Window. See if i can turn that off.Fokke van Saane @Fokke
ah wait, it works on stereo to 5.1 but not on stereo to stereo tracks.
Fokke van Saane @Fokke
To continue the sequel, i was wrong again! It DOES work on stereo to stereo tracks, but we get the error when the automation mode is set to READ! It should be on Touch Write or Latch.
- In reply tochrscheuer⬆:NNicolai Linck @Nicolai_Linck7
This is great!. Is there a way to detect if the output window is open and if it is move on with the script? Right now it closes the window and gives you an error..
Thanks in advance- SSreejesh Nair @Sreejesh_Nair
This should help. This is what I use as it considers both track as well as object outputs.
let outputWindowState = sf.ui.proTools.selectedTrack.outputWindowButton.value.invalidate().value; if (!["open", "output bypassed active open"].includes(outputWindowState)) { sf.ui.proTools.selectedTrack.trackOutputToggleShow(); }
- NNicolai Linck @Nicolai_Linck7
It works like a charm, but it somehow breaks the panning setting..
- NNicolai Linck @Nicolai_Linck7
And it somehow also closes all open insert windows?
- SSreejesh Nair @Sreejesh_Nair
Strange. Works perfectly on my system. What panning setting is it breaking?
- NNicolai Linck @Nicolai_Linck7
Ahh got it right.. I misplaced it and it messed up the panning.. Thank you so much for helping
- VIn reply tochrscheuer⬆:Vanessa Garde @Vanessa_Garde
Hi there,
How would you modify it to Set Center% Knob to 0? (not putting it on preview, as I just want a start point with tracks on "read" without going to the center channel on the Center % pan setting...?
Thanks a lot! Happy new year!