Hi there,
Just trying to make a simple macro to create a click track and send it to my preferred output pair.
Can anyone tell me why this isn't working?
sf.ui.proTools.menuClick({
menuPath: ["Track", "Create Click Track"],
});
sf.ui.proTools.selectedTrack.trackOutputSelect({
outputPath: ["output", "CP 17-18 (Stereo)"],
});
I'm also attaching a picture of the track output menu with the desired track selected "CP 17-18 (Stereo) -> MTRX 9-10"
Any help would be appreciated!

- Raphael Sepulveda @raphaelsepulveda2021-09-26 22:00:26.499Z
Hey Drew,
You just have to complete the entire name of the output, like so:
sf.ui.proTools.selectedTrack.trackOutputSelect({ outputPath: ["output", "CP 17-18 (Stereo) -> MTRX 9-10"], });
- DDrew Jurecka @Drew_Jurecka
Hi Raphael,
Thanks for your response.
This is what I tried initially and it didn't work. I just tried it again and I'm afraid it still throws up an error.Raphael Sepulveda @raphaelsepulveda2021-09-27 02:01:07.696Z
Mmmm.. that's weird. Try this approach:
sf.ui.proTools.selectedTrack.groups.whoseTitle.is("Audio IO").first.popupButtons.allItems[1].popupMenuSelect({ menuPath: ["output", "CP 17-18 (Stereo) -> MTRX 9-10"] });
- DDrew Jurecka @Drew_Jurecka
that doesn't work either. Very weird.
Here's the error that comes up:
<< Command: Click Track w Default Outs [user:ckpxmxj6l0000pt10mszpvhzm:cku1mcu4c00026m102tbf28sw]
27.09.2021 01:08:44.81 [Backend]: #Key: f13 (105) -> Click Track w Default Outs [cku1mdbpp00036m1011mr6t2w]
Validating command... user:ckpxmxj6l0000pt10mszpvhzm:cku1mcu4c00026m102tbf28sw
Invoking command...user:ckpxmxj6l0000pt10mszpvhzm:cku1mcu4c00026m102tbf28sw27.09.2021 01:08:44.81 [Backend]: >> Command: Click Track w Default Outs [user:ckpxmxj6l0000pt10mszpvhzm:cku1mcu4c00026m102tbf28sw]
27.09.2021 01:08:45.25 [Backend]: AXUIElementException in LoadUIElement: kAXErrorInvalidUIElement
Logging error in action (01) TrackSelectOutputAction: Could not find selected track's output button27.09.2021 01:08:45.25 [Backend]: !! Command Error: Click Track w Default Outs [user:ckpxmxj6l0000pt10mszpvhzm:cku1mcu4c00026m102tbf28sw]:
Could not find selected track's output button (Click Track w Default Outs: Line 13)
SoundFlow.Shortcuts.AXUIElementException: kAXErrorInvalidUIElement
at SoundFlow.Shortcuts.AXUIElement.GetSubElements(String, Int32) + 0x1a7
at SoundFlow.Shortcuts.AXUIElement.GetElementByTitle(String) + 0x4e
at SoundFlow.Shortcuts.Ax.AxNodes.AxPtTrackOutputPathButton.GetIO(AXUIElement) + 0x20
at SoundFlow.Shortcuts.Ax.AxNodes.AxPtTrackOutputPathButton.GetUIElement() + 0x48
at SoundFlow.Shortcuts.Ax.AxNodes.AxElement.LoadUIElement() + 0x27 (AxPtTrackOutputPathButton)<< Command: Click Track w Default Outs [user:ckpxmxj6l0000pt10mszpvhzm:cku1mcu4c00026m102tbf28sw]
- DIn reply toDrew_Jurecka⬆:Drew Jurecka @Drew_Jurecka
Just one addition - I JUST tried this script and it worked. Once. With the original language
sf.ui.proTools.selectedTrack.trackOutputSelect({
outputPath: ["output", "CP 17-18 (Stereo) -> MTRX 9-10"],
});And then it stopped working again. Can't get it to happen a second time.
Kinda makes it seem like an issue with how SOundFlow is interacting with ProTools... - DIn reply toDrew_Jurecka⬆:Drew Jurecka @Drew_Jurecka
@raphaelsepulveda
One more update, as I troubleshoot this further:If I restart SoundFlow and then run this command immediately, it will work one time. Then not at all. Same with a system restart. Works once and then never again.
Obviously the script CAN work since it will execute sometimes, which makes it seem like a bug with SoundFlow...
Raphael Sepulveda @raphaelsepulveda2021-09-27 06:07:46.498Z
Ahh, good find! Sounds like it's in need of invalidation.
Try placing the following line before the code that sets the output:
sf.ui.proTools.mainWindow.invalidate();
- DDrew Jurecka @Drew_Jurecka
That got it! Thanks!
Out of curiosity, what does 'invalidation' do? Is it something I should be trying in other problematic scripts?Raphael Sepulveda @raphaelsepulveda2021-09-27 07:23:09.454Z
Awesome!
Invalidating basically refreshes SoundFlow’s data cache. SoundFlow deals with this automatically pretty well but sometimes we have to help it.
In this case, SoundFlow’s awareness of the tracks in the session is not getting refreshed after the new click track is created. That’s why we invalidate the mainWindow, to get a current snapshot of the data present in it.
If you’d like to learn more, here’s an awesome post Christian wrote about it: When to use invalidate() #post-2