Title
Shot navigation script (previous cut - next cut) not running
What do you expect to happen when you run the script/macro?
Hi,
I'm trying to set up this script to navigate my shot track but nothing happens when I run it, It's basically supposed to go to a track named SHOT, hit TAB, then go back to the originally selected track. Any help would be much appreciated!
Are you seeing an error?
What happens when you run this script?
Nothing
How were you running this script?
I clicked the "Run Script" or "Run Macro" button in SoundFlow
How important is this issue to you?
5
Details
{ "inputExpected": "Hi, \n\nI'm trying to set up this script to navigate my shot track but nothing happens when I run it, It's basically supposed to go to a track named ***SHOT***, hit TAB, then go back to the originally selected track. Any help would be much appreciated!", "inputIsError": false, "inputWhatHappens": "Nothing", "inputHowRun": { "key": "-MpfwYA4I6GGlXgvp5j1", "title": "I clicked the \"Run Script\" or \"Run Macro\" button in SoundFlow" }, "inputImportance": 5, "inputTitle": "Shot navigation script (previous cut - next cut) not running" }
Source
const trackName = "***SHOT***"
function getNextCut() {
let previouslySelectedTrackNames = sf.ui.proTools.selectedTrackNames;
/// Get cut Track
sf.ui.proTools.trackGetByName(trackName).track.trackSelect();
/// Tab to next Cut
sf.keyboard.press({
keys: "tab",
});
/// Select orginal Tracks
sf.ui.proTools.trackSelectByName({ names: previouslySelectedTrackNames, deselectOthers: true });
}
Links
User UID: MwqrVLXkfRPbLC92MshYzEMJClR2
Feedback Key: sffeedback:MwqrVLXkfRPbLC92MshYzEMJClR2:-OPDSvPMnOMeF6TiMuyF
Feedback ZIP: Xy847dSheD8Ii+O4GStJLVlY+k/nAizZGU/RE9yaixM14gB1FyHaiTYm977xJv+B55OAsagVu2oDN9gIOPuk2j54VSB0PIvkgoIX1DwJtNrj7GW/CQqqyTPC0sfVMdFnRQuxBFuM32w1tU/uuCkWJN1cZJTazqXB6kpezxVuzjxS6z5RYlR7lyaKYxaJA4+Ij7fEDkyqzJtB7+ayemxz6bpgHaWxbp65jKvXUYGiOQVFIIrHK8uo0FzIlOI29ZZlRJa5RPJ/+UsWWL2YcGxkkzE9ZR2RBZTJSqal9wbEnt5LXdbM6uSE5jp4Rtlx6Ody6ZK3I0EArf5wl7+4aQPGV0VonrpjtCo34XsIgWtO5s0=
- Chris Shaw @Chris_Shaw2025-05-02 01:24:53.798Z
You've defined the function but haven't called it (line 16 below):
const trackName = "***SHOT***" function getNextCut() { let previouslySelectedTrackNames = sf.ui.proTools.selectedTrackNames; /// Get cut Track sf.ui.proTools.trackGetByName(trackName).track.trackSelect(); /// Tab to next Cut sf.keyboard.press({ keys: "tab", }); /// Select orginal Tracks sf.ui.proTools.trackSelectByName({ names: previouslySelectedTrackNames, deselectOthers: true }); } getNextCut()
Chris Shaw @Chris_Shaw2025-05-02 01:29:02.964Z2025-05-02 01:35:44.088Z
You should pass the track name into the function as an argument so it can be reused with different tracks. I've renamed the variable for clarity.
const cutTrackName = "***SHOT***" function getNextCut(targetTrack) { let previouslySelectedTrackNames = sf.ui.proTools.selectedTrackNames; /// Get cut Track sf.ui.proTools.trackGetByName(targetTrack).track.trackSelect(); /// Tab to next Cut sf.keyboard.press({ keys: "tab", }); /// Select orginal Tracks sf.ui.proTools.trackSelectByName({ names: previouslySelectedTrackNames, deselectOthers: true }); } getNextCut(cutTrackName)
(I haven't tested this but it should work) :
- AIn reply toAlexis_Feodoroff⬆:Alexis Feodoroff @Alexis_Feodoroff
Thanks for your help Chris! I'm now getting this error: TypeError: Cannot read property 'trackSelect' of null
(***Next SHOT line 6)Sorry if it's super obvious!
- AIn reply toAlexis_Feodoroff⬆:Alexis Feodoroff @Alexis_Feodoroff
I got it to work running this script:
//Activate Pro Tools sf.ui.proTools.appActivate(); sf.ui.proTools.invalidate(); const previouslySelectedTrackNames = sf.ui.proTools.selectedTrackNames; /// Name your Pic cut Track here sf.ui.proTools.trackGetByName({ name: "***SHOT***", makeVisible: true }).track.trackSelect(); sf.keyboard.press({ keys: "tab", }); sf.ui.proTools.trackSelectByName({ names: previouslySelectedTrackNames, deselectOthers: true });
But I'd be interested to know what was wrong withe the previous script for learning's sake, thank you!