No internet connection
  1. Home
  2. How to

Duplicate tracks without any media

By Fokke van Saane @Fokke
    2018-07-22 19:00:56.446Z

    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.

    Solved in post #2, click to view
    • 38 replies

    There are 38 replies. Estimated reading time: 14 minutes

    1. S
      Sean @SeanH
        2018-07-23 02:25:43.173Z

        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
        
        })
        
        Reply1 LikeSolution
        1. Fokke van Saane @Fokke
            2018-07-23 08:11:21.647Z

            Nice, thanks!

            How do i add a rename track command after this?

            1. SSean @SeanH
                2018-07-23 18:17:53.059Z

                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.

                1. Fokke van Saane @Fokke
                    2018-07-24 10:04:39.506Z

                    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' } }

                    1. @Fokke
                      I think this is what you're looking for:

                      sf.ui.proTools.selectedTrack.trackOpenRenameDialog();
                      
                      1. sf.ui.proTools.selectedTrack.trackRename({
                            newName: 'the new name'
                        });
                        

                        is for renaming to something specific from your script

                      2. In reply toFokke:
                        ?@anon6770933309
                          2018-07-25 13:26:19.812Z

                          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.

                          1. Fokke van Saane @Fokke
                              2018-07-25 15:55:25.160Z

                              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 FX7

                              So, 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?)

                              1. ?@anon6770933309
                                  2018-07-25 16:09:23.100Z

                                  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();
                                  
                                  
                                  1. Fokke van Saane @Fokke
                                      2018-07-25 16:16:33.472Z

                                      which is what i had, isn't it?
                                      In my macro above the dialog stays open too.

                                      1. ?@anon6770933309
                                          2018-07-25 16:24:11.965Z

                                          No, check the last line.

                                          1. Fokke van Saane @Fokke
                                              2018-07-25 16:28:35.958Z

                                              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();

                                              1. Fokke van Saane @Fokke
                                                  2018-07-25 16:33:55.508Z

                                                  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" ?

                                                  1. 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) + '');
                                                        }
                                                    });
                                                    
                                                    1. This is fixed now in internal build.

                                                      1. Fokke van Saane @Fokke
                                                          2018-07-25 19:38:04.593Z

                                                          This would be so awesome! Just with a click on the SD a new track without making all the settings. how cool' !

                                                          1. In reply tochrscheuer:
                                                            Fokke van Saane @Fokke
                                                              2018-07-29 15:45:19.091Z

                                                              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) {

                                                              1. I'll take a look - thanks Fokke.

                                                                1. Fokke van Saane @Fokke
                                                                    2018-07-29 15:47:55.530Z2018-07-29 16:02:28.351Z

                                                                    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) + '');
                                                                        }
                                                                    });
                                                                    
                                                                    1. 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".

                                                                      1. Fokke van Saane @Fokke
                                                                          2018-07-29 16:18:19.583Z

                                                                          The track was called

                                                                          4

                                                                          If i nameitsomething4

                                                                          it works!

                                                                          1. 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) + '');
                                                                                }
                                                                            });
                                                                            
                                                                            1. MMiro Wolf @Miro_Wolf
                                                                                2021-11-03 16:07:50.945Z

                                                                                Hi There!

                                                                                Powerful function! I would love it to disable recording on the original track and enable recording on the duplicated one, any ideas?

                                                                                1. 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
                                                                                  2018-07-29 16:21:12.390Z

                                                                                  Ah, cool!
                                                                                  4
                                                                                  works now too !
                                                                                  will be duplicated to
                                                                                  5

                                                                                  11.dup1
                                                                                  will duplicate into
                                                                                  12

                                                                                  That 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"

                                                                                  1. 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) + '');
                                                                                        }
                                                                                    });
                                                                                    
                                                                                    1. Fokke van Saane @Fokke
                                                                                        2018-07-29 16:29:21.160Z

                                                                                        Christian, this is so cool!
                                                                                        It makes adding similar tracks so easy now! Beautiful!

                                                                                        1. In reply tochrscheuer:

                                                                                          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"?

                                                                                          1. Ah okay. Just saw this post now. Cool :)

                                                                                            1. 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!

                                                                                            2. In reply tochrscheuer:
                                                                                              Fokke van Saane @Fokke
                                                                                                2018-07-29 16:32:37.075Z

                                                                                                We are slow- chatting! Things get confusing, especially when i post too quickly and edit my posts.... sorry!

                                                                                                1. Haha yup.. No worries! It's just a lot of fun that it is so quick to develop new features/scripts.

                                                                                                  1. Fokke van Saane @Fokke
                                                                                                      2018-07-29 16:34:14.393Z

                                                                                                      It is, it is!

                                                        • M
                                                          In reply toFokke:
                                                          Martin Pavey @Martin_Pavey
                                                            2019-09-07 17:02:19.830Z

                                                            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.

                                                            1. Thank you Martin! Happy to hear it.

                                                              1. Fokke van Saane @Fokke
                                                                  2019-09-07 21:02:14.669Z

                                                                  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 fails

                                                                  1. Thanks Fokke. Logging this

                                                              2. C
                                                                In reply toFokke:
                                                                Christian Best @Christian_Best
                                                                  2020-10-10 16:05:31.482Z

                                                                  This looks fantastic,,cant seem to find it tho,,can someone point me in the right direction pls

                                                                  1. Progress
                                                                  2. @chrscheuer marked this topic as Planned 2018-07-24 15:31:48.152Z.
                                                                  3. @chrscheuer marked this topic as Started 2018-07-24 15:31:49.016Z.
                                                                  4. @chrscheuer marked this topic as Done 2018-07-24 15:31:49.904Z.
                                                                  5. @chrscheuer marked this topic as New 2019-06-17 11:13:37.431Z.