Rename Multiple Busses in PT io
Hello,
I'm new to Soundflow and wondering if it could solve a common task I need to complete for preparing mix sessions. Usually I re-use an IO template with stems/verbs/auxes all labelled according to their instrument group, and then just rename things as needed. Eg "Synths" and all associated busses from one project might be converted to "effects" in another.
Ideally there would be a way to create a sort of 'batch rename' for the io page but that seems improbable/too complex.
Alternatively I thought I could batch rename my stemming/verb tracks in the edit window and then copy their track names to their input busses.
Maybe this script (for copying selected track names to comments) could be reworked to copy track names to input names?
function setComments(hasAlt) {
sf.ui.proTools.appActivateMainWindow()
sf.ui.proTools.invalidate()
//Get visible Tracks
const visibleTracks = sf.ui.proTools.visibleTrackHeaders
//Scrool to view first track
visibleTracks[0].trackScrollToView()
// Open rename window
visibleTracks[0].popupButtons.first.mouseClickElement({ clickCount: 2 })
// Wait for rename window
sf.ui.proTools.windows.whoseTitle.is(visibleTracks[0].popupButtons.first.value.invalidate().value).first.elementWaitFor();
//Get the elements of text fields and buttons
const [trackName, comments] = sf.ui.proTools.focusedWindow.invalidate().textFields.map(x => x)
const [ok, cncl, pr, next] = sf.ui.proTools.focusedWindow.buttons.map(x => x)
// Loop all tracks
for (let i = 0; i < visibleTracks.length; i++) {
if (hasAlt) {
// Clear comments
comments.elementSetTextFieldWithAreaValue({
value: '',
});
} else {
// Set track name in Cmments
while (true) {
if (trackName.value.invalidate().value != comments.value.invalidate().value) {
comments.elementSetTextFieldWithAreaValue({
value: trackName.value.invalidate().value,
});
sf.wait({ intervalMs: 5 })
} else {
break;
}
};
};
// If its the last track press ok, else press next
if (i === visibleTracks.length - 1) {
ok.elementClick()
} else {
next.elementClick()
};
};
};
const hasAlt = event.keyboardState.hasAlt
setComments(hasAlt)
I started and got as far as opening the io rename menu but am very stuck and would appreciate any assistance!
sf.ui.proTools.appActivateMainWindow()
sf.ui.proTools.invalidate()
//Get visible Tracks
const selectedTracks = sf.ui.proTools.selectedTrackHeaders
//Scrool to view first track
selectedTracks[0].trackScrollToView()
// Open rename window
selectedTracks[0].popupButtons.first.mouseClickElement({ clickCount: 2, relativePosition: { x: +2, y: +5 } })
// Wait for rename window
sf.ui.proTools.windows.whoseTitle.is(selectedTracks[0].popupButtons.first.value.invalidate().value).first.elementWaitFor();
//Get the elements of text fields and buttons
const [trackName, comments] = sf.ui.proTools.focusedWindow.invalidate().textFields.map(x => x)
const [ok, cncl, pr, next] = sf.ui.proTools.focusedWindow.buttons.map(x => x)
ok.elementClick();
//Open input bus rename window
sf.ui.proTools.selectedTrack.inputPathButton.popupMenuSelect({
isRightClick: true,
menuPath: ['Rename...']
})
//Get the elements of text fields and buttons
const inputName = sf.ui.proTools.confirmationDialog.textFields.first
// Clear inputname
inputName.elementSetTextFieldWithAreaValue {trackName};
- RRose @RMPau
Update! I have figured out a way of doing this (see below). I'm sure there are better ways, but this is working!
sf.ui.proTools.appActivateMainWindow() sf.ui.proTools.invalidate(); function doForAllSelectedTracks(action) { var originallySelectedTrackNames = sf.ui.proTools.selectedTrackNames; try { sf.ui.proTools.selectedTrackHeaders.forEach(track => { track.trackSelect(); action(track); }); } finally { sf.ui.proTools.trackSelectByName({ names: originallySelectedTrackNames }); } } /**@param {AxPtTrackHeader} track */ function trackFunc(track) { // Open rename window sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({ isRightClick: true, menuPath: ['Rename...'] }) //Copy sf.keyboard.press({ keys: "cmd+c, enter", fast: true, }) //Open input bus rename window sf.ui.proTools.selectedTrack.inputPathButton.popupMenuSelect({ isRightClick: true, menuPath: ['Rename...'] }) //Paste sf.keyboard.press({ keys: "cmd+v, enter", fast: true, }) log(track.normalizedTrackName); } doForAllSelectedTracks(trackFunc);