I made a KM macro for this, so SF could it too.
I use this when i am working on a film, like adding SFX's. I made tracks that go to a bus, have a color, etc. Then, i need another track similar to this. I could make a template track, and i have done that, but it is much quicker if i already have such a track, to duplicate it, without the playlists.
So, tracks>Duplicate... and then deselect everything except Group Assignments and Insert After Last Selected Track.
I even added a Rename Track to my macro that deletes the ".dup1" and leaves the Track Rename window open for me to add a new name.
- SSean @SeanH
hi Fokke!
I think this is what you want to duplicate a track with no audio playlists in sf —
sf.ui.proTools.trackDuplicateSelected({ duplicateActivePlaylist: false, duplicateAlternatePlaylists: false, })
or the full version:
sf.ui.proTools.trackDuplicateSelected({ duplicateActivePlaylist: false, duplicateAlternatePlaylists: false, duplicateAutomation: true, duplicateGroupAssignments: true, duplicateInserts: true, duplicateSends: true, insertAfterLastSelectedTrack: true, numberOfDuplicates: 1 })
Fokke van Saane @Fokke
Nice, thanks!
How do i add a rename track command after this?
- SSean @SeanH
I think it may be something along the lines of this:
sf.ui.proTools.selectedTrack.trackRename();
or
sf.ui.proTools.selectedTrack.trackBulkRename();
or
sf.ui.proTools.selectedTrack.trackBulkRenameNumerical();
but all the track rename commands are currently broken on my system for a weird reason I can't track down, so I'm not using them at the moment, don't know for sure if these would work at the moment.
Fokke van Saane @Fokke
Thanks!
It works, but i still get an SF error
Now i have this:
sf.ui.proTools.trackDuplicateSelected({
duplicateActivePlaylist: false,
duplicateAlternatePlaylists: false,
duplicateAutomation: false,
duplicateGroupAssignments: true,
duplicateInserts: false,
duplicateSends: false,
insertAfterLastSelectedTrack: true,
numberOfDuplicates: 1})sf.ui.proTools.selectedTrack.trackRename()
;The log gives me this error:
error: 'Script error at line 12\n Could not enter new name (TrackRenameAction)\n System.ArgumentNullException: Value cannot be null.\nParameter name: str\n at CFString..ctor(String) + 0x55\n at SoundFlow.Shortcuts.AXUIElement.SetStringValue(String, String) + 0x49\n at SoundFlow.Shortcuts.Automation.Actions.DialogEnterTextAction.d__13.MoveNext() + 0x3a9\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1b\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x45\n at SoundFlow.Shortcuts.Automation.AutoAction`1.d__13.MoveNext() + 0x1a9\n\n' } }Christian Scheuer @chrscheuer2018-07-24 15:29:28.461Z
@Fokke
I think this is what you're looking for:sf.ui.proTools.selectedTrack.trackOpenRenameDialog();
Christian Scheuer @chrscheuer2018-07-24 15:33:13.653Z
sf.ui.proTools.selectedTrack.trackRename({ newName: 'the new name' });
is for renaming to something specific from your script
- In reply toFokke⬆:?@anon6770933309
You forgot something. 😉
Try this:sf.ui.proTools.trackDuplicateSelected({ duplicateActivePlaylist: false, duplicateAlternatePlaylists: false, duplicateAutomation: false, duplicateGroupAssignments: true, duplicateInserts: false, duplicateSends: false, insertAfterLastSelectedTrack: true, numberOfDuplicates: 1 }) sf.ui.proTools.selectedTrack.trackRename({ newName: 'myNewName' });
Change 'myNewName' to the name you want to use for that track.
Fokke van Saane @Fokke
Thats a nice idea, but usually it is used like this;
i have an FX track that is called FX6 for example
And i need another one like that.
Then i do this duplicate track command
And i have to rename it to FX7So, the new name is always different and depends on the kind of track. And therefore i cannot put the name in the macro.
What WOULD help if the macro reads the last number and does +1.
In case of no number at the end of the track it adds 2.
Would that be possible? (of course it is, but is it simple?)- ?@anon6770933309
Thats different from what you were originally requesting.
If you want to have the Rename window to stay open then it would be something like this:sf.ui.proTools.trackDuplicateSelected({ duplicateActivePlaylist: false, duplicateAlternatePlaylists: false, duplicateAutomation: false, duplicateGroupAssignments: true, duplicateInserts: false, duplicateSends: false, insertAfterLastSelectedTrack: true, numberOfDuplicates: 1 }) sf.ui.proTools.selectedTrack.trackOpenRenameDialog();
Fokke van Saane @Fokke
which is what i had, isn't it?
In my macro above the dialog stays open too.- ?@anon6770933309
No, check the last line.
Fokke van Saane @Fokke
Christian gave me the answer why i had an error.
this was mine but gave an error
sf.ui.proTools.selectedTrack.trackRename()
;corrected by Christian as you can read below:
sf.ui.proTools.selectedTrack.trackOpenRenameDialog();This is yours
sf.ui.proTools.selectedTrack.trackOpenRenameDialog();Fokke van Saane @Fokke
So, you both agree. :-)
But, do you think it is possible, when the TrackRename is open, SF can delete the last 4 characters; "dup1", then read the current name, and if there is a number at the end, add 1 to it.
So, if i duplicate track "Dialog19"
The duplicated track will first be called "Dialog19.dup1"
Could SF turn this into "Dialog20" ?Christian Scheuer @chrscheuer2018-07-25 19:25:40.103Z
Hi @Fokke
This function should do exactly that - BUT unfortunately the 'renameFunction' does not yet work in scripting. I'll make sure we fix that before next alpha release.
sf.ui.proTools.selectedTrack.trackRename({ renameFunction: function(name) { var grps = name.match(/^([^\d]+)(\d+)\.dup.*/); var baseName = grps[1]; var num = Number(grps[2]); return baseName + ((num+1) + ''); } });
Christian Scheuer @chrscheuer2018-07-25 19:35:03.362Z
This is fixed now in internal build.
Fokke van Saane @Fokke
This would be so awesome! Just with a click on the SD a new track without making all the settings. how cool' !
- In reply tochrscheuer⬆:
Fokke van Saane @Fokke
I presume it is not ready yet in 2.0.0 beta 3.4?
error:
error: 'Script error at line 12\n Could not enter new name (TrackRenameAction)\n TypeError\n' } }line 12 is:
renameFunction: function(name) {Christian Scheuer @chrscheuer2018-07-29 15:46:55.536Z
I'll take a look - thanks Fokke.
Fokke van Saane @Fokke
Thanks.
This is what i have now:sf.ui.proTools.trackDuplicateSelected({ duplicateActivePlaylist: false, duplicateAlternatePlaylists: false, duplicateAutomation: false, duplicateGroupAssignments: true, duplicateInserts: false, duplicateSends: false, insertAfterLastSelectedTrack: true, numberOfDuplicates: 1}) sf.ui.proTools.selectedTrack.trackRename({ renameFunction: function(name) { var grps = name.match(/^([^\d]+)(\d+)\.dup.*/); var baseName = grps[1]; var num = Number(grps[2]); return baseName + ((num+1) + ''); } });
Christian Scheuer @chrscheuer2018-07-29 16:00:38.319Z
What's the full name of the track you are trying to duplicate, before the duplication?
Looks like it doesn't match the regular expression I've made.
If I test with an audio track named for instance "Audio 5" (and there's no "Audio 6") then it duplicates the Audio 5 and renames it to "Audio 6".Fokke van Saane @Fokke
The track was called
4
If i nameitsomething4
it works!
Christian Scheuer @chrscheuer2018-07-29 16:20:06.942Z
Ah gotcha. Okay that is also supported now in this:
Notice the+
changing to a*
- eg. the pre-digit group is now optional, not required.sf.ui.proTools.trackDuplicateSelected({ duplicateActivePlaylist: false, duplicateAlternatePlaylists: false, duplicateAutomation: false, duplicateGroupAssignments: true, duplicateInserts: false, duplicateSends: false, insertAfterLastSelectedTrack: true, numberOfDuplicates: 1 }) sf.ui.proTools.selectedTrack.trackRename({ renameFunction: function (name) { var grps = name.match(/^([^\d]*)(\d+).dup.*/); var baseName = grps[1]; var num = Number(grps[2]); return baseName + ((num + 1) + ''); } });
- MMiro Wolf @Miro_Wolf
Hi There!
Powerful function! I would love it to disable recording on the original track and enable recording on the duplicated one, any ideas?
Christian Scheuer @chrscheuer2021-11-03 22:55:01.686Z
Hi Miro,
It's better to open a new thread with your question because this is already marked solved (and quite old) - please feel free to quote this thread / link to it in your new thread.
- In reply toFokke⬆:
Fokke van Saane @Fokke
Ah, cool!
4
works now too !
will be duplicated to
511.dup1
will duplicate into
12That is a bit odd. although the 'dup1' was what i wanted to get rid off. But once it IS there, it behaves differently. Maybe it is not a problem, maybe it is even better then "11.dup2"
Christian Scheuer @chrscheuer2018-07-29 16:25:38.193Z
This should cover that case as well:
sf.ui.proTools.selectedTrack.trackRename({ renameFunction: function (name) { var grps = name.match(/^([^\d]*)(\d*)\.dup.*/);; var baseName = grps[1]; var num = grps[2] == "" ? 1 : Number(grps[2]); return baseName + ((num + 1) + ''); } });
Fokke van Saane @Fokke
Christian, this is so cool!
It makes adding similar tracks so easy now! Beautiful!- In reply tochrscheuer⬆:
Christian Scheuer @chrscheuer2018-07-29 16:30:55.014Z
Oh, did you edit your post or did the forum alter something?
I'm confused now. Why should 11.dup1 not be renamed to 12? If you have a 11.dup1 it must be because you are trying to duplicate "11", in which case I suspect you want "12"?Christian Scheuer @chrscheuer2018-07-29 16:31:11.364Z
Ah okay. Just saw this post now. Cool :)
Christian Scheuer @chrscheuer2018-07-29 16:31:43.646Z
And yes you're right. I just moved this script from my "test" folder to my "Pro Tools Master" folder and assigned it a permanent shortcut. For sure a very very nice feature!
- In reply tochrscheuer⬆:
Fokke van Saane @Fokke
We are slow- chatting! Things get confusing, especially when i post too quickly and edit my posts.... sorry!
Christian Scheuer @chrscheuer2018-07-29 16:33:56.551Z
Haha yup.. No worries! It's just a lot of fun that it is so quick to develop new features/scripts.
Fokke van Saane @Fokke
It is, it is!
- MIn reply toFokke⬆:Martin Pavey @Martin_Pavey
Wow, this duplicate track and re-number shortcut is fantastic!
Thanks for sorting this out guys, this has been bugging me for years using Keyboard Maestro.
Very Cool.Christian Scheuer @chrscheuer2019-09-07 21:00:25.698Z
Thank you Martin! Happy to hear it.
Fokke van Saane @Fokke
although it might fail when the track is at the very bottom so the right click menu doesn't find the item, because it flips upside.
And when the track has no number at the end the Regex failsChristian Scheuer @chrscheuer2019-09-07 21:12:12.914Z
Thanks Fokke. Logging this
- CIn reply toFokke⬆:Christian Best @Christian_Best
This looks fantastic,,cant seem to find it tho,,can someone point me in the right direction pls
- Progress