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!
Christian Scheuer @chrscheuer2019-09-18 09:25:07.350ZThis 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();
Chris Shaw @Chris_Shaw2021-01-19 23:27:17.446ZThis is insanely useful for this archival project I working on.
Thanks- In reply tochrscheuer⬆:
Chris Shaw @Chris_Shaw2021-01-28 18:11:18.412Z2021-02-02 22:20:25.877ZA 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"], }) }
Chris Shaw @Chris_Shaw2021-02-02 22:20:58.690ZRevised : Added
sf.ui.proTools.invalidate();- NNenad Simsic @Nenad_Simsic
With PT 2023.6 this script does not work anymore! Is there any chance to have a look into this?
thanx, Nenad
- In reply tochrscheuer⬆:
Matt Friedman @Matt_FriedmanThis doesn't seem to work anymore. Looks like SF can no longer click on the Comments Field??? (PT 2023.6)
Christian Scheuer @chrscheuer2023-11-07 15:25:13.460Zcc @Kitch - it's likely you'll need to add a slight offset to the
mouseClickElementcall to make the mouse click happen in the right location.
Matt Friedman @Matt_FriedmanI actually found solution in another thread here just changing
commentsField.mouseClickElement()tocommentsField.elementClick()
- AIn reply toGraham_Archer⬆:Andrés Giraldo @Andres_Giraldo
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!
- RRyan @Ryno
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
- JIn reply toGraham_Archer⬆:Judson Crane @Judson_Crane
wondering if there is a new script for this function that is compatible with current version of PT? Thanks!
Chris Shaw @Chris_Shaw2025-09-07 17:20:09.555Z2025-12-29 17:29:37.254ZThis should do it.
If alt/option is held while triggering this script it will clear all comments from selected tracks:/** * Sets comments on selected tracks to match their track names. * If Alt is held, comments will be cleared instead. * * @param {boolean} hasAlt - Whether the Alt key is held down. */ function setComments(hasAlt) { // Ensure Pro Tools is active and refreshed sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); // Get selected tracks const selectedTracks = sf.app.proTools.tracks.invalidate().allItems.filter(t => t.selectedState == "SetExplicitly"); if (!selectedTracks.length) throw "No tracks selected"; // Scroll first track into view and open rename window const firstTrack = selectedTracks[0]; const firstTrackHeader = sf.ui.proTools.trackGetByName({ name: firstTrack.name }).track; sf.ui.proTools.trackSelectByName({ names: [firstTrack.name] }); sf.ui.proTools.selectedTrack.trackScrollToView(); firstTrackHeader.titleButton.mouseClickElement({ clickCount: 2, relativePosition: { x: 5, y: 5 } }); // Wait for the rename window sf.ui.proTools.windows.whoseTitle.is(firstTrack.name).first.elementWaitFor(); const renameWindow = sf.ui.proTools.focusedWindow.invalidate(); // ───────────────────────────── // Map text fields and buttons // ───────────────────────────── const [trackNameField, commentsField] = renameWindow.textFields.map(x => x); const [okBtn, , , nextBtn] = renameWindow.buttons.map(x => x); // Helper to sync or clear comments function updateComments() { if (hasAlt) { commentsField.elementSetTextFieldWithAreaValue({ value: '' }); return; } while (trackNameField.value.invalidate().value !== commentsField.value.invalidate().value) { commentsField.elementSetTextFieldWithAreaValue({ value: trackNameField.value.invalidate().value }); } } // Process each track selectedTracks.forEach((track, i) => { updateComments(); const isLast = i === selectedTracks.length - 1; (isLast ? okBtn : nextBtn).elementClick(); }); // Reselect all processed tracks sf.app.proTools.selectTracksByName({ trackNames: selectedTracks.map(t => t.name) }); // ───────────────────────────── // Final notification // ───────────────────────────── sf.interaction.notify({ title: "Update Track Comments", message: hasAlt ? "Comments cleared on selected tracks." : "Comments set to track names.", keepAliveMs: 3000 }); } // Entry point setComments(event.keyboardState.hasAlt);
Chris Shaw @Chris_Shaw2025-09-07 17:22:53.046Z2025-09-07 17:58:59.671ZThis is a refactor of @samuel_henriques excellent script from this thread:
Copy track name and paste to PT scribble strip...
I updated it to take advantage of some of the newer SF / PT SDK commands
Ben Rubin @Ben_RubinHey Chris, looking like this script needs a bit of refactor to run in v6.
Getting an error : TypeError: Cannot read property 'value' of undefined
at line 42:while (trackNameField.value.invalidate().value !== commentsField.value.invalidate().value) {Thanks in advance!
Chris Shaw @Chris_Shaw2025-12-29 17:29:14.414ZHm, I'm getting a different issue with the rename window not appearing - which is different than what you're experiencing - that I've fixed.
I need the usual info: SF/PT versions and a screen recording.
Did you haveif (sf.ui.useSfx ) sf.ui.useSfx();at the top?
It would probably need a major refactor to us sfx
Ben Rubin @Ben_RubinThanks for the fast reply, @Chris_Shaw.
I am on the latest PT and SF. Here is the screen capture:
https://house-of-cha-cha.digitalpigeon.com/shr/qRiawOTeEfCP3wL7g8nSUw/yAVy2Ju7KIt9HGM7X4_reA/file/ad4183f0-e4de-11f0-8506-06bba855e915#I had turned off sfx when I got the above error.
When I add the "if" code, the script fails at a different place:firstTrackHeader.titleButton.mouseClickElement({ clickCount: 2, relativePosition: { x: 5, y: 5 } });fine by me if it doesnt use sfx, if it is working.
Chris Shaw @Chris_Shaw2025-12-29 18:02:55.260ZI updated the code above to fix the error I was getting perhaps it works now?
Ben Rubin @Ben_RubinYes, working now as long as SFX is not enabled. Good enough for me! Thanks, Chris!