Anyone know a way to do this? Would be great to be able to batch-process either kind of folder. Specifically for me, I want to be able to make all basic folders micro height and make all routing folder show the volume automation lane (in separate scripts).
thanks!
- Ben Rubin @Ben_Rubin
any ideas? @Kitch @Chris_Shaw @samuel_henriques @chrscheuer ??
samuel henriques @samuel_henriques
Hello Ben,
Here's "make all basic folders micro height". Let me know how it goes.
function getCurrentTrackHeight(h) { let originalTrackHeight; switch (true) { case (h <= 16): originalTrackHeight = 'micro'; break; case (h === 23): originalTrackHeight = 'mini'; break; case (h >= 43 && h <= 61): originalTrackHeight = 'small'; break; case (h >= 79 && h <= 116): originalTrackHeight = 'medium'; break; case (h >= 135 && h <= 235): originalTrackHeight = 'large'; break; case (h >= 257 && h <= 420): originalTrackHeight = 'jumbo'; break; case (h > 440): originalTrackHeight = 'extreme'; break; } return originalTrackHeight }; /** * @param {'micro'|'mini'|'small'|'medium'|'large'|'jumbo'|'extreme'|'fit to window' } size */ function setTrackSize(size) { const f = sf.ui.proTools.selectedTrack.frame if (getCurrentTrackHeight(f.h) != size) { const popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({ relativePosition: { x: f.w - 10, y: 5 }, isOption: true, isShift: true, }).popupMenu; popupMenu.menuClickPopupMenu({ menuPath: [size] }); } } function selectBasicFolders() { const trackHeaders = sf.ui.proTools.visibleTrackHeaders; const basicFolders = trackHeaders.filter(h => h.title.value.endsWith("- Basic Folder Track ")).map(h => h.normalizedTrackName); const firstBasicFolderTrack = sf.ui.proTools.trackGetByName({ name: basicFolders[0] }).track firstBasicFolderTrack.trackSelect(); firstBasicFolderTrack.trackScrollToView(); sf.ui.proTools.trackSelectByName({ names: basicFolders }); }; function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); selectBasicFolders(); setTrackSize("micro"); }; main();
- In reply toBen_Rubin⬆:
samuel henriques @samuel_henriques
Here's " make all routing folder show the volume automation lane". This presumes the state of the first folder to take action, so there could be some cases it won't work as expected. Let me know how it works and we'll tweak it.
have fun
/** * @param {'micro'|'mini'|'small'|'medium'|'large'|'jumbo'|'extreme'|'fit to window' } size */ function setTrackSize(size) { const f = sf.ui.proTools.selectedTrack.frame const popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({ relativePosition: { x: f.w - 10, y: 5 }, isOption: true, isShift: true, }).popupMenu; popupMenu.menuClickPopupMenu({ menuPath: [size] }); }; function selectRoutingFolders() { const trackHeaders = sf.ui.proTools.visibleTrackHeaders; const routingFolders = trackHeaders.filter(h => h.title.value.endsWith("- Routing Folder Track ")).map(h => h.normalizedTrackName); const firstBasicFolderTrack = sf.ui.proTools.trackGetByName({ name: routingFolders[0] }).track firstBasicFolderTrack.trackSelect(); firstBasicFolderTrack.trackScrollToView(); sf.ui.proTools.trackSelectByName({ names: routingFolders }); }; function openAutomationLane() { //Check if track is too small to show automation lane btn const trackSize = sf.ui.proTools.selectedTrack.frame trackSize.h <= 43 ? setTrackSize("small") : null; const isAutomationLaneOpen = sf.ui.proTools.mainWindow.groups.allItems[111].buttons.first.invalidate().exists if (!isAutomationLaneOpen) { sf.ui.proTools.selectedTrack.children.whoseRole.is("AXDisclosureTriangle").whoseTitle.is("Show/hide automation lanes").first.mouseClickElement({ isOption: true, isShift: true }); } }; function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); selectRoutingFolders(); openAutomationLane(); } main()
- In reply toBen_Rubin⬆:Ben Rubin @Ben_Rubin
wow @samuel_henriques, thanks so much.
Once I added
sf.ui.proTools.trackDeselectAll()
after "invalidate" in the main function, they both work great, even if tracks are already selected.
The Show Volume Lane script works just as you wrote it, but sorry if I was unclear, as I'd like Volume to be in the main automation lane (replacing the default "Overview",) not the automation lanes accessed by hitting the little icon. Is this possible?
much thanks
ben
- In reply toBen_Rubin⬆:Ben Rubin @Ben_Rubin
Here are my tweaks so far to the "Make all Basic Folders Micro" script.
I've added:
Store and Restore Selected Tracks
Switch to Edit Window if on Mix Window (and then switch back)
the aforementioned Deselect All Tracks just before Main Functionsf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); // Place the following two functions at the top of your script: // #1 function mainWindowStatus() { if (sf.ui.proTools.getMenuItem('Window', 'Mix').isMenuChecked) { sf.ui.proTools.menuClick({ menuPath: ["Window", "Edit"], }); return "Mix"; } else { return "Edit"; } } //#2 function returnToStartingMainWIndow(mainWindow) { if (mainWindow == "Mix") { sf.ui.proTools.menuClick({ menuPath: ["Window", "Mix"], }); } } /// Place this line at the top of your script let startingWindow = mainWindowStatus(); // Store Selected Track let selectedTracks = sf.ui.proTools.selectedTrackNames; function getCurrentTrackHeight(h) { let originalTrackHeight; switch (true) { case (h <= 16): originalTrackHeight = 'micro'; break; case (h === 23): originalTrackHeight = 'mini'; break; case (h >= 43 && h <= 61): originalTrackHeight = 'small'; break; case (h >= 79 && h <= 116): originalTrackHeight = 'medium'; break; case (h >= 135 && h <= 235): originalTrackHeight = 'large'; break; case (h >= 257 && h <= 420): originalTrackHeight = 'jumbo'; break; case (h > 440): originalTrackHeight = 'extreme'; break; } return originalTrackHeight }; /** * @param {'micro'|'mini'|'small'|'medium'|'large'|'jumbo'|'extreme'|'fit to window' } size */ function setTrackSize(size) { const f = sf.ui.proTools.selectedTrack.frame if (getCurrentTrackHeight(f.h) != size) { const popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({ relativePosition: { x: f.w - 10, y: 5 }, isOption: true, isShift: true, }).popupMenu; popupMenu.menuClickPopupMenu({ menuPath: [size] }); } } function selectBasicFolders() { const trackHeaders = sf.ui.proTools.visibleTrackHeaders; const basicFolders = trackHeaders.filter(h => h.title.value.endsWith("- Basic Folder Track ")).map(h => h.normalizedTrackName); const firstBasicFolderTrack = sf.ui.proTools.trackGetByName({ name: basicFolders[0] }).track firstBasicFolderTrack.trackSelect(); firstBasicFolderTrack.trackScrollToView(); sf.ui.proTools.trackSelectByName({ names: basicFolders }); }; function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); sf.ui.proTools.trackDeselectAll() selectBasicFolders(); setTrackSize("micro"); }; main(); // Restore Selection sf.ui.proTools.trackDeselectAll(); sf.ui.proTools.trackSelectByName({ names: selectedTracks, deselectOthers: true, }); // end your script with this line returnToStartingMainWIndow(startingWindow);
- In reply toBen_Rubin⬆:Ben Rubin @Ben_Rubin
Realizing, of course, there will be little reason to start this script from the Mix Window, but hey, the capability is there.
So here is my version of the script to make all Routing Folders show Volume on its main Display Lane. Getting all the tracks to change to Volume is super-easy by just using "-" w Command Focus enabled.
sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); // Place the following two functions at the top of your script: // #1 function mainWindowStatus() { if (sf.ui.proTools.getMenuItem('Window', 'Mix').isMenuChecked) { sf.ui.proTools.menuClick({ menuPath: ["Window", "Edit"], }); return "Mix"; } else { return "Edit"; } } //#2 function returnToStartingMainWIndow(mainWindow) { if (mainWindow == "Mix") { sf.ui.proTools.menuClick({ menuPath: ["Window", "Mix"], }); } } /// Place this line at the top of your script let startingWindow = mainWindowStatus(); // Store Selected Track let selectedTracks = sf.ui.proTools.selectedTrackNames; /** * @param {'micro'|'mini'|'small'|'medium'|'large'|'jumbo'|'extreme'|'fit to window' } size */ function setTrackSize(size) { const f = sf.ui.proTools.selectedTrack.frame const popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({ relativePosition: { x: f.w - 10, y: 5 }, isOption: true, isShift: true, }).popupMenu; popupMenu.menuClickPopupMenu({ menuPath: [size] }); }; function selectRoutingFolders() { const trackHeaders = sf.ui.proTools.visibleTrackHeaders; const routingFolders = trackHeaders.filter(h => h.title.value.endsWith("- Routing Folder Track ")).map(h => h.normalizedTrackName); const firstBasicFolderTrack = sf.ui.proTools.trackGetByName({ name: routingFolders[0] }).track firstBasicFolderTrack.trackSelect(); firstBasicFolderTrack.trackScrollToView(); sf.ui.proTools.trackSelectByName({ names: routingFolders }); }; function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); sf.ui.proTools.trackDeselectAll() selectRoutingFolders(); sf.keyboard.press({ keys: "minus", }); } main() // Restore Selection sf.ui.proTools.trackDeselectAll(); sf.ui.proTools.trackSelectByName({ names: selectedTracks, deselectOthers: true, }); // end your script with this line returnToStartingMainWIndow(startingWindow);
Thanks again for your help, @samuel_henriques!!! Any ideas about tackling this one:
Show only active automation lanes on a selected track?samuel henriques @samuel_henriques
Great job, just to make sure, are you all set with his script?
Ben Rubin @Ben_Rubin
yes! i'm all set on this one. Thanks so much!