Pro Tools Main Counter and Gridlines toggle
I am a new SoundFlow user and came across a Youtube video of Kitch Membery illustrating a script that he created for a Pro Tools keyboard shortcut to toggle through several states (from Timecode to Bars and Beats) of the Main Counter. I have never scripted before and am wanting to do something similar but involving both the Main Counter and the Timeline Grid as well. What I would like to do is use a Stream Deck button to toggle through 3 combinations of
Main Counter/SubCounter/Timeline Grid:
Min:Sec/Bars|Beats/1 millisecond gridlines
Bars|Beats/Min:Sec/1 bar gridlines
Bars|Beats/Min:Sec/quarter note gridlines
Perhaps the Main Counter and Timeline Grid would have to be toggled separately, thus using two Stream Deck buttons rather than just one.
Has anybody already done this? Could I have access to your script to use it or to attempt to modify it?
Sincere Thanks!
- Kitch Membery @Kitch2022-08-08 21:38:14.764Z
Hi @Gerry_Valenti,
This should do the trick.
const settings = { option1: { mainCounterMode: "Min:Secs", subCounterMode: "Bars|Beats", timelineGridValue: " 0:00.001", timelineGridMenuItem: "1 msec" }, option2: { mainCounterMode: "Bars|Beats", subCounterMode: "Min:Secs", timelineGridValue: " 1| 0| 000", timelineGridMenuItem: "1 bar" }, option3: { mainCounterMode: "Bars|Beats", subCounterMode: "Min:Secs", timelineGridValue: " 0| 1| 000", timelineGridMenuItem: "1/4 note" }, } function setMainCounterMode({ mode }) { sf.ui.proTools.getMenuItem('View', 'Main Counter', mode).elementClick(); } function setSubCounterMode({ mode }) { sf.ui.proTools.mainWindow.counterDisplay.buttons.whoseTitle.is("Sub Counter selector").first.popupMenuSelect({ menuPath: [mode], }); } function setTimelineGridValue({ value }) { sf.ui.proTools.mainWindow.gridNudgeCluster.popupButtons.first.popupMenuSelect({ menuPath: [value] }) } function main() { //Activate and Invalidate main window sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); const subCounterText = sf.ui.proTools.mainWindow.counterDisplay.children.whoseRole.is("AXStaticText").whoseValue.is("Sub").first; const mainCounterSelectorPopup = sf.ui.proTools.mainWindow.counterDisplay.buttons.whoseTitle.is("Main Counter selector").first; //Ensure the Sub Counter is visible if (!subCounterText.exists) { mainCounterSelectorPopup.popupMenuSelect({ menuPath: ["Show Sub Counter"], }); } //Store the Current Settings const currentSettings = { timelineGridValue: sf.ui.proTools.mainWindow.gridNudgeCluster.popupButtons.first.value.invalidate().value, } if (currentSettings.timelineGridValue === settings.option1.timelineGridValue) { //Switch to option 2 settings setMainCounterMode({ mode: settings.option2.mainCounterMode }); setSubCounterMode({ mode: settings.option2.subCounterMode }); setTimelineGridValue({ value: settings.option2.timelineGridMenuItem }); } else if (currentSettings.timelineGridValue === settings.option2.timelineGridValue) { //Switch to option 3 settings setMainCounterMode({ mode: settings.option3.mainCounterMode }); setSubCounterMode({ mode: settings.option3.subCounterMode }); setTimelineGridValue({ value: settings.option3.timelineGridMenuItem }); } else { //Switch to option 1 settings setMainCounterMode({ mode: settings.option1.mainCounterMode }); setSubCounterMode({ mode: settings.option1.subCounterMode }); setTimelineGridValue({ value: settings.option1.timelineGridMenuItem }); } } main();
Note: I have the Grid set to follow Main Time Scale. so that it does the mode switching automatically.
I hope that helps :-)
Rock on! - GIn reply toGerry_Valenti⬆:Gerry Valenti @Gerry_Valenti
It works great! Simple task, but this combines multiple button-pushes into just one.
Thank you so much...