No internet connection
  1. Home
  2. Support

Copy track names to comments boxes in Pro Tools?

By Graham Archer @Graham_Archer
    2019-09-18 09:07:47.889Z

    Is there a way to get access to the comments boxes in Pro Tools using SF without double clicking on the track name and then using a series of CMD+Right Arrow moves?

    I'd like to be able to copy Track names to comments boxes for selected tracks, for an entire session, and also delete all text written in comments boxes too.

    Please let me know if it's possible! Thanks!

    Solved in post #2, click to view
    • 10 replies
    1. This should do it:

      function setComment(trackHeader, text) {
          var commentsField = trackHeader.textFields.whoseTitle.startsWith('Comments').first;
          commentsField.mouseClickElement();
          sf.keyboard.press({ keys: 'cmd+a' });
          sf.keyboard.type({ text: text });
          sf.keyboard.press({ keys: 'return' });
      }
      
      function setCommentsToTrackNames() {
          var tracks = sf.ui.proTools.selectedTracks.trackHeaders;
          for (var i = 0; i < tracks.length; i++) {
              var track = tracks[i];
              setComment(track, track.normalizedTrackName);
          }
      }
      
      setCommentsToTrackNames();
      
      Reply2 LikesSolution
      1. This is insanely useful for this archival project I working on.
        Thanks

        1. In reply tochrscheuer:
          Chris Shaw @Chris_Shaw2021-01-28 18:11:18.412Z2021-02-02 22:20:25.877Z

          A slightly more robust version that makes sure that the selected track is scrolled into view (otherwise it fails) and opens and closes the comments field if not initially visable:

          function setComment(trackHeader, text) {
              var commentsField = trackHeader.textFields.whoseTitle.startsWith('Comments').first;
              commentsField.mouseClickElement();
              sf.keyboard.press({ keys: 'cmd+a' });
              sf.keyboard.type({ text: text });
              sf.keyboard.press({ keys: 'return' });
          }
          
          function setCommentsToTrackNames() {
              var trackNames = sf.ui.proTools.selectedTrackNames
              var tracks = sf.ui.proTools.selectedTracks.trackHeaders;
              for (var i = 0; i < tracks.length; i++) {
                  var track = tracks[i];
          
                  sf.ui.proTools.trackSelectByName({ names: [trackNames[i]] });
                  sf.ui.proTools.selectedTrack.trackScrollToView({});
                  setComment(track, track.normalizedTrackName);
              }
          }
          sf.ui.proTools.appActivateMainWindow();
          sf.ui.proTools.invalidate();
          let areCommentsVisible = sf.ui.proTools.getMenuItem("View", "Edit Window Views", "Comments").isMenuChecked
          if (!areCommentsVisible) {
              sf.ui.proTools.menuClick({ menuPath: ["View", "Edit Window Views", "Comments"], })
          }
          setCommentsToTrackNames();
          
          if (!areCommentsVisible) {
              sf.ui.proTools.menuClick({ menuPath: ["View", "Edit Window Views", "Comments"], })
          }
          
          1. Revised : Added sf.ui.proTools.invalidate();

            1. NNenad Simsic @Nenad_Simsic
                2023-06-19 11:26:40.832Z

                With PT 2023.6 this script does not work anymore! Is there any chance to have a look into this?

                thanx, Nenad

            2. In reply tochrscheuer:
              MMatt Friedman @Matt_Friedman
                2023-11-06 22:21:10.821Z

                This doesn't seem to work anymore. Looks like SF can no longer click on the Comments Field??? (PT 2023.6)

                1. cc @Kitch - it's likely you'll need to add a slight offset to the mouseClickElement call to make the mouse click happen in the right location.

                  1. MMatt Friedman @Matt_Friedman
                      2023-11-07 17:14:13.991Z

                      I actually found solution in another thread here just changing

                      commentsField.mouseClickElement() to commentsField.elementClick()

                2. A
                  In reply toGraham_Archer:
                  Andrés Giraldo @Andres_Giraldo
                    2021-09-28 16:08:00.306Z

                    What about if you want to do it the other way around? I mean copying the comments to the track name? What should change in the code?

                    Thanks!

                    1. RRyan @Ryno
                        2023-09-05 10:30:01.711Z

                        I'd love this "track names to comments" script to work, I came here to request it and it's not working in the latest builds of Pro Tools