Split Selected Clip(s) at Markers” – System.FormatException when Main Counter is in Timecode
Hi all, running the latest PT, 2025,10 and the latest SF 6,0,1
I ran into an issue with the “Split Selected Clip(s) at Markers” command and thought I’d document it here in case it helps someone (or the script can be updated).
This is the error from the SoundFlow log:
!! Command Error: Split Selected Clip(s) at Markers:
Could not ensure main counter (Split Selected Clip(s) at Markers: Line 5)
System.FormatException: The input string '00:58:52:21' was not in a correct format.
at System.Number.ThrowFormatException[TChar](ReadOnlySpan`1) + 0x4c
at SoundFlow.Shortcuts.Automation.Actions.GetSelectionInSamplesAction.<>c__DisplayClass5_0.<<Execute>b__1>d.MoveNext() + 0x20c
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x100
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at SoundFlow.Shortcuts.Automation.Actions.DoMainCounterAction.<Execute>d__13.MoveNext() + 0x270
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x100
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at SoundFlow.Shortcuts.Automation.AutoAction`1.<Run>d__25.MoveNext() + 0x368
The key line is:
System.FormatException: The input string '00:58:52:21' was not in a correct format.
What was going on
- In Pro Tools, my Main Counter was set to Timecode.
- The command internally calls
GetSelectionInSamplesAction/DoMainCounterAction, which (based on the error) tries to parse the Main Counter value as a numeric type. - When the Main Counter string is something like
00:58:52:21(HH:MM:SS:FF timecode), .NET can’t parse that directly as a number, so it throws aSystem.FormatException.
So essentially the script expects a numeric value (e.g. samples or maybe Min:Secs), but it gets a timecode string and chokes on it.
Simple workaround / fix
As soon as I switched the Pro Tools Main Counter to Samples, the command worked perfectly.
Steps:
- In Pro Tools, click the Main Counter display.
- Change it from Timecode to Samples.
- Make sure the clip is selected.
- Run “Split Selected Clip(s) at Markers” again in SoundFlow.
No more error, and the clips split as expected at the markers.
Possible improvement
If the script is reading from the Main Counter text and parsing it, it might be more robust to:
-
Either:
- Force the Main Counter to Samples programmatically before reading it, or
-
Use the Pro Tools/Surface API to fetch the selection in samples directly, instead of parsing the Main Counter display string.
But for anyone hitting this problem: check that your Main Counter is set to Samples before running the command – that solved it for me.
Chris Shaw @Chris_Shaw2025-11-14 17:06:47.212Z2025-11-14 17:17:54.935ZIt's seems from what you're describing that you're using
sf.uicalls to get start times from markers. Using SDK commands is much simpler and it doesn't require setting the main counter to a specific format - the SDK uses samples at all times.Check this post for a a script that separates clips at markers on a selected track. It aslo consolidates the clips between markers but you can just delete that part of the code as described in the post:
Separate clip at marker location #post-2