bug: trackSelect methods aren't updating clip detection
Issue: After making a selection in Pro Tools that contains a clip, then using a track selection script method or macro to select a track with no clips, Pro Tools still thinks a clip is selected.
The macro:

Expected behavior: When manually selecting a different track as normal (with link timeline + track and edit selection buttons enabled), Pro Tools correctly disables menu functions when no clips are selected.

Weird behavior: After running the macro, or other variations in scripting such as sf.ui.proTools.trackSelectByName(...), Pro Tools seems to still think that a clip in within the selection.

Note in both cases, the clip is deselected from the Clip List.
Changing the selection length, then putting it back seems to correct the issue, so there are work arounds, but still it doesn't seem like intended behavior.
Cheers!
- OOwen Granich-Young @Owen_Granich_Young
Sometimes the menu's need a kick to refresh... this is one of the hacks to do it I've learned here on the forum
///Re-evaluate here... HACK TO REFRESH MENUS sf.keyboard.press({ keys: 'n', fast: true, repetitions: 2 });
or another one
/// Reset Menu sf.keyboard.press({ keys: "left", repetitions: 2, fast: true, });
I believe this is the issue you are finding?
- IIan Shedd @Ian_Shedd
Yes the menu refresh is the issue. I've found similar workarounds, i'll add yours to the arsenal, thanks!
- OOwen Granich-Young @Owen_Granich_Young
Oh they ain't my tricks, just things I've learned here.
- In reply toOwen_Granich_Young⬆:OOwen Granich-Young @Owen_Granich_Young
Is there any new SDK related tech to better do this? I'm in a situation where even this doesn't seem to be refreshing the menus.
Chris Shaw @Chris_Shaw2024-05-03 20:08:21.093Z
This may be a shot in the dark but maybe try invalidating the tracks via the SDK:
sf.app.proTools.tracks.invalidate()
If that doesn't work try using the SDK to reselect selected tracks:
const tracks = sf.app.proTools.tracks.invalidate().allItems; const selectedTracks = tracks.filter(t => t.isSelected).map(t => t.name); sf.app.proTools.selectTracksByName({ trackNames: selectedTracks, selectionMode: "Replace" })
Let me know if either of these work - I don't have any scripts experiencing this issue
- OOwen Granich-Young @Owen_Granich_Young
i may try this for other things, my current issue is a menu refresh i didn't realize what i was responding too lol, i'm gonna try an alternative work around though.
also ooooo didn't realize sf.app.proTools.selectTracksByName was implemented. excuse me while i replace code in 5000 scripts :P
Chris Shaw @Chris_Shaw2024-05-03 21:46:50.815Z
I’m thinking that invalidating / reselecting tracks would force a menu refresh
Chris Shaw @Chris_Shaw2024-05-03 21:48:03.206Z
It only takes about 150ms to re-select a couple dozen tracks with the SDK commands
- OOwen Granich-Young @Owen_Granich_Young
I am super stoked about this... definitely going to spend a couple days at some point updating all my packages to use this instead of .ui should fix a lot of inconsistencies and speed to boot.
Chris Shaw @Chris_Shaw2024-05-03 21:55:37.749Z
I updated one of my session prep scripts that I wrote ages ago before I knew anything and implemented the SDK commands and cut the execution time in half
Chris Shaw @Chris_Shaw2024-05-03 21:56:22.516Z
The track select command saves a boatload of time.
- In reply toChris_Shaw⬆:OOwen Granich-Young @Owen_Granich_Young
True true, I also realized i had the .isEnabled in the totally wrong place in the script, once i moved it worked much smoother. pretty proud of the code over all though Copy region edits to next track - is a script like this possible? #post-29 finally cracking 'count fades and crossfades all as one clip'